eazy-git 0.2.6 → 0.2.7
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/README.md +64 -22
- package/dist/git.js +6 -6
- package/dist/index.js +113 -113
- package/dist/install.js +1 -1
- package/dist/run.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,174 +1,174 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`)}var
|
|
4
|
-
`),d=!1;for(let g=0;g<
|
|
5
|
-
`){o&&(r+=
|
|
6
|
-
`&&(i&&
|
|
7
|
-
`),o=0,a=e;for(let c of i){if(a<=c.length)break;a-=c.length+1,o++}for(o=Math.max(0,Math.min(i.length-1,o+s)),a=Math.min(a,i[o].length)+t;a<0&&o>0;)o--,a+=i[o].length+1;for(;a>i[o].length&&o<i.length-1;)a-=i[o].length+1,o++;a=Math.max(0,Math.min(i[o].length,a));let
|
|
2
|
+
var dr=Object.create;var nt=Object.defineProperty;var mr=Object.getOwnPropertyDescriptor;var pr=Object.getOwnPropertyNames;var gr=Object.getPrototypeOf,fr=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(e&&(t=e(e=0)),t);var $r=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yr=(e,t)=>{for(var s in t)nt(e,s,{get:t[s],enumerable:!0})},vr=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pr(t))!fr.call(e,i)&&i!==s&&nt(e,i,{get:()=>t[i],enumerable:!(r=mr(t,i))||r.enumerable});return e};var Wt=(e,t,s)=>(s=e!=null?dr(gr(e)):{},vr(t||!e||!e.__esModule?nt(s,"default",{value:e,enumerable:!0}):s,e));var qt,Ht,Kt,zt=we(()=>{qt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let s=0;for(e.lastIndex=0;e.test(t);)s+=1;return t.length-s}})(),Ht=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Kt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141});var br,wr,Jt,Cr,Yt,Ir,Sr,Er,Qt,Xt,Zt=we(()=>{zt();br=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,wr=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Jt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Cr=/\t{1,1000}/y,Yt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,Ir=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Sr=/\p{M}+/gu,Er={limit:1/0,ellipsis:""},Qt=(e,t={},s={})=>{let r=t.limit??1/0,i=t.ellipsis??"",o=t?.ellipsisWidth??(i?Qt(i,Er,s).width:0),a=0,l=s.controlWidth??0,c=s.tabWidth??8,u=s.emojiWidth??2,d=2,g=s.regularWidth??1,p=s.wideWidth??d,y=[[Ir,g],[br,a],[wr,l],[Cr,c],[Yt,u],[Jt,p]],m=0,b=0,$=e.length,v=0,C=!1,T=$,R=Math.max(0,r-o),x=0,L=0,M=0,k=0;e:for(;;){if(L>x||b>=$&&b>m){let N=e.slice(x,L)||e.slice(m,b);v=0;for(let W of N.replaceAll(Sr,"")){let w=W.codePointAt(0)||0;if(Ht(w)?k=d:Kt(w)?k=p:k=g,M+k>R&&(T=Math.min(T,Math.max(x,m)+v)),M+k>r){C=!0;break e}v+=W.length,M+=k}x=L=0}if(b>=$)break e;for(let N=0,W=y.length;N<W;N++){let[w,O]=y[N];if(w.lastIndex=b,w.test(e)){if(v=w===Jt?qt(e.slice(b,w.lastIndex)):w===Yt?1:w.lastIndex-b,k=v*O,M+k>R&&(T=Math.min(T,b+Math.floor((R-M)/O))),M+k>r){C=!0;break e}M+=k,x=m,L=b,b=m=w.lastIndex;continue e}}b+=1}return{width:C?R:M,index:C?T:$,truncated:C,ellipsed:C&&r>=o}},Xt=Qt});var xr,Tr,j,ot=we(()=>{Zt();xr={limit:1/0,ellipsis:"",ellipsisWidth:0},Tr=(e,t={})=>Xt(e,xr,t).width,j=Tr});function se(e,t,s){return String(e).normalize().split(Mr).map(r=>Fr(r,t,s)).join(`
|
|
3
|
+
`)}var ke,is,Rr,ct,ns,_r,os,lt,es,ts,ss,rs,at,Ar,Fr,Mr,ut=we(()=>{ot();ke="\x1B",is="\x9B",Rr=39,ct="\x07",ns="[",_r="]",os="m",lt=`${_r}8;;`,es=new RegExp(`(?:\\${ns}(?<code>\\d+)m|\\${lt}(?<uri>.*)${ct})`,"y"),ts=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},ss=e=>`${ke}${ns}${e}${os}`,rs=e=>`${ke}${lt}${e}${ct}`,at=(e,t,s)=>{let r=t[Symbol.iterator](),i=!1,o=!1,a=e.at(-1),l=a===void 0?0:j(a),c=r.next(),u=r.next(),d=0;for(;!c.done;){let g=c.value,p=j(g);l+p<=s?e[e.length-1]+=g:(e.push(g),l=0),(g===ke||g===is)&&(i=!0,o=t.startsWith(lt,d+1)),i?o?g===ct&&(i=!1,o=!1):g===os&&(i=!1):(l+=p,l===s&&!u.done&&(e.push(""),l=0)),c=u,u=r.next(),d+=g.length}a=e.at(-1),!l&&a!==void 0&&a.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ar=e=>{let t=e.split(" "),s=t.length;for(;s&&!j(t[s-1]);)s--;return s===t.length?e:t.slice(0,s).join(" ")+t.slice(s).join("")},Fr=(e,t,s={})=>{if(s.trim!==!1&&e.trim()==="")return"";let r="",i,o,a=e.split(" "),l=[""],c=0;for(let g=0;g<a.length;g++){let p=a[g];if(s.trim!==!1){let m=l.at(-1)??"",b=m.trimStart();m.length!==b.length&&(l[l.length-1]=b,c=j(b))}g!==0&&(c>=t&&(s.wordWrap===!1||s.trim===!1)&&(l.push(""),c=0),(c||s.trim===!1)&&(l[l.length-1]+=" ",c++));let y=j(p);if(s.hard&&y>t){let m=t-c,b=1+Math.floor((y-m-1)/t);Math.floor((y-1)/t)<b&&l.push(""),at(l,p,t),c=j(l.at(-1)??"");continue}if(c+y>t&&c&&y){if(s.wordWrap===!1&&c<t){at(l,p,t),c=j(l.at(-1)??"");continue}l.push(""),c=0}if(c+y>t&&s.wordWrap===!1){at(l,p,t),c=j(l.at(-1)??"");continue}l[l.length-1]+=p,c+=y}s.trim!==!1&&(l=l.map(g=>Ar(g)));let u=l.join(`
|
|
4
|
+
`),d=!1;for(let g=0;g<u.length;g++){let p=u[g];if(r+=p,d)d=!1;else if(d=p>="\uD800"&&p<="\uDBFF",d)continue;if(p===ke||p===is){es.lastIndex=g+1;let m=es.exec(u)?.groups;if(m?.code!==void 0){let b=Number.parseFloat(m.code);i=b===Rr?void 0:b}else m?.uri!==void 0&&(o=m.uri.length===0?void 0:m.uri)}if(u[g+1]===`
|
|
5
|
+
`){o&&(r+=rs(""));let y=i?ts(i):void 0;i&&y&&(r+=ss(y))}else p===`
|
|
6
|
+
`&&(i&&ts(i)&&(r+=ss(i)),o&&(r+=rs(o)))}return r},Mr=/\r?\n/});var mt=$r((pn,as)=>{"use strict";var ht="\x1B",D=`${ht}[`,Or="\x07",dt={to(e,t){return t?`${D}${t+1};${e+1}H`:`${D}${e+1}G`},move(e,t){let s="";return e<0?s+=`${D}${-e}D`:e>0&&(s+=`${D}${e}C`),t<0?s+=`${D}${-t}A`:t>0&&(s+=`${D}${t}B`),s},up:(e=1)=>`${D}${e}A`,down:(e=1)=>`${D}${e}B`,forward:(e=1)=>`${D}${e}C`,backward:(e=1)=>`${D}${e}D`,nextLine:(e=1)=>`${D}E`.repeat(e),prevLine:(e=1)=>`${D}F`.repeat(e),left:`${D}G`,hide:`${D}?25l`,show:`${D}?25h`,save:`${ht}7`,restore:`${ht}8`},Br={up:(e=1)=>`${D}S`.repeat(e),down:(e=1)=>`${D}T`.repeat(e)},kr={screen:`${D}2J`,up:(e=1)=>`${D}1J`.repeat(e),down:(e=1)=>`${D}J`.repeat(e),line:`${D}2K`,lineEnd:`${D}K`,lineStart:`${D}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?dt.up():"");return e&&(t+=dt.left),t}};as.exports={cursor:dt,scroll:Br,erase:kr,beep:Or}});import{styleText as Ce}from"node:util";import{stdout as $t,stdin as hs}from"node:process";import*as ae from"node:readline";import Lr from"node:readline";import{ReadStream as cs}from"node:tty";function oe(e,t,s){if(!s.some(a=>!a.disabled))return e;let r=e+t,i=Math.max(s.length-1,0),o=r<0?i:r>i?0:r;return s[o].disabled?oe(o,t<0?-1:1,s):o}function Le(e,t,s,r){let i=r.split(`
|
|
7
|
+
`),o=0,a=e;for(let c of i){if(a<=c.length)break;a-=c.length+1,o++}for(o=Math.max(0,Math.min(i.length-1,o+s)),a=Math.min(a,i[o].length)+t;a<0&&o>0;)o--,a+=i[o].length+1;for(;a>i[o].length&&o<i.length-1;)a-=i[o].length+1,o++;a=Math.max(0,Math.min(i[o].length,a));let l=0;for(let c=0;c<o;c++)l+=i[c].length+1;return l+a}function ds(e){if(e.aliases!==void 0){let t=e.aliases;for(let s in t){if(!Object.hasOwn(t,s))continue;let r=t[s];I.actions.has(r)&&(I.aliases.has(s)||I.aliases.set(s,r))}}if(e.messages!==void 0){let t=e.messages;t.cancel!==void 0&&(I.messages.cancel=t.cancel),t.error!==void 0&&(I.messages.error=t.error)}if(e.withGuide!==void 0&&(I.withGuide=e.withGuide!==!1),e.date!==void 0){let t=e.date;t.monthNames!==void 0&&(I.date.monthNames=[...t.monthNames]),t.messages!==void 0&&(t.messages.required!==void 0&&(I.date.messages.required=t.messages.required),t.messages.invalidMonth!==void 0&&(I.date.messages.invalidMonth=t.messages.invalidMonth),t.messages.invalidDay!==void 0&&(I.date.messages.invalidDay=t.messages.invalidDay),t.messages.afterMin!==void 0&&(I.date.messages.afterMin=t.messages.afterMin),t.messages.beforeMax!==void 0&&(I.date.messages.beforeMax=t.messages.beforeMax))}}function yt(e,t){if(typeof e=="string")return I.aliases.get(e)===t;for(let s of e)if(s!==void 0&&yt(s,t))return!0;return!1}function Dr(e,t){if(e===t)return;let s=e.split(`
|
|
8
8
|
`),r=t.split(`
|
|
9
|
-
`),i=Math.max(s.length,r.length),o=[];for(let a=0;a<i;a++)s[a]!==r[a]&&o.push(a);return{lines:o,numLinesBefore:s.length,numLinesAfter:r.length,numLines:i}}function
|
|
10
|
-
`).map((
|
|
11
|
-
`)}function
|
|
9
|
+
`),i=Math.max(s.length,r.length),o=[];for(let a=0;a<i;a++)s[a]!==r[a]&&o.push(a);return{lines:o,numLinesBefore:s.length,numLinesAfter:r.length,numLines:i}}function Ie(e){return e===gt}function Pe(e,t){let s=e;s.isTTY&&s.setRawMode(t)}function ms({input:e=hs,output:t=$t,overwrite:s=!0,hideCursor:r=!0}={}){let i=ae.createInterface({input:e,output:t,prompt:"",tabSize:1});ae.emitKeypressEvents(e,i),e instanceof cs&&e.isTTY&&e.setRawMode(!0);let o=(a,{name:l,sequence:c})=>{let u=String(a);if(yt([u,l,c],"cancel")){r&&t.write(K.cursor.show),process.exit(0);return}if(!s)return;ae.moveCursor(t,l==="return"?0:-1,l==="return"?-1:0,()=>{ae.clearLine(t,1,()=>{e.once("keypress",o)})})};return r&&t.write(K.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),r&&t.write(K.cursor.show),e instanceof cs&&e.isTTY&&!Vr&&e.setRawMode(!1),i.terminal=!1,i.close()}}function G(e,t,s,r=s,i=s,o){let a=he(e??$t);return se(t,a-s.length,{hard:!0,trim:!1}).split(`
|
|
10
|
+
`).map((l,c,u)=>{let d=o?o(l,c):l;return c===0?`${r}${d}`:c===u.length-1?`${i}${d}`:`${s}${d}`}).join(`
|
|
11
|
+
`)}function Ur(e,t){if(e===void 0||t.length===0)return 0;let s=t.findIndex(r=>r.value===e);return s!==-1?s:0}function Gr(e,t){return(t.label??String(t.value)).toLowerCase().includes(e.toLowerCase())}function jr(e,t){if(t)return e?t:t[0]}function ls(e){return[...e].map(t=>Wr[t])}function qr(e){let t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2e3,0,15)),s=[],r="/";for(let i of t)i.type==="literal"?r=i.value.trim()||i.value:(i.type==="year"||i.type==="month"||i.type==="day")&&s.push({type:i.type,len:i.type==="year"?4:2});return{segments:s,separator:r}}function pt(e){return Number.parseInt((e||"0").replace(/_/g,"0"),10)||0}function Ne(e){return{year:pt(e.year),month:pt(e.month),day:pt(e.day)}}function ft(e,t){return new Date(e||2001,t||1,0).getDate()}function ps(e){let{year:t,month:s,day:r}=Ne(e);if(!t||t<0||t>9999||!s||s<1||s>12||!r||r<1)return;let i=new Date(Date.UTC(t,s-1,r));if(!(i.getUTCFullYear()!==t||i.getUTCMonth()!==s-1||i.getUTCDate()!==r))return{year:t,month:s,day:r}}function us(e){let t=ps(e);return t?new Date(Date.UTC(t.year,t.month-1,t.day)):void 0}function Hr(e,t,s,r){let i=s?{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}:null,o=r?{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}:null;return e==="year"?{min:i?.year??1,max:o?.year??9999}:e==="month"?{min:i&&t.year===i.year?i.month:1,max:o&&t.year===o.year?o.month:12}:{min:i&&t.year===i.year&&t.month===i.month?i.day:1,max:o&&t.year===o.year&&t.month===o.month?o.day:ft(t.year,t.month)}}var K,Pr,Nr,I,Vr,gt,he,vt,ne,bt,De,Wr,Ve,Ue,Ge,gs,je,We,qe,He,wt=we(()=>{ut();K=Wt(mt(),1);Pr=["up","down","left","right","space","enter","cancel"],Nr=["January","February","March","April","May","June","July","August","September","October","November","December"],I={actions:new Set(Pr),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...Nr],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};Vr=globalThis.process.platform.startsWith("win"),gt=Symbol("clack:cancel");he=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,vt=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;ne=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:s=hs,output:r=$t,render:i,signal:o,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=o,this.input=s,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let s=this._subscribers.get(e)??[];s.push(t),this._subscribers.set(e,s)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let s=this._subscribers.get(e)??[],r=[];for(let i of s)i.cb(...t),i.once&&r.push(()=>s.splice(s.indexOf(i),1));for(let i of r)i()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(gt);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Lr.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Pe(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Pe(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(K.cursor.show),this.output.off("resize",this.render),Pe(this.input,!1),e(gt)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&I.aliases.has(t.name)&&this.emit("cursor",I.aliases.get(t.name)),I.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let s=this.opts.validate(this.value);s&&(this.error=s instanceof Error?s.message:s,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}yt([e,t?.name,t?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
12
12
|
`),Pe(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=se(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
13
|
-
`).length-1;this.output.write(
|
|
14
|
-
`);this.output.write(a[o]),this._prevFrame=e,this.output.write(
|
|
13
|
+
`).length-1;this.output.write(K.cursor.move(-999,e*-1))}render(){let e=se(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(K.cursor.hide);else{let t=Dr(this._prevFrame,e),s=vt(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-s),i=Math.max(0,t.numLinesBefore-s),o=t.lines.find(a=>a>=r);if(o===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(K.cursor.move(0,o-i)),this.output.write(K.erase.lines(1));let a=e.split(`
|
|
14
|
+
`);this.output.write(a[o]),this._prevFrame=e,this.output.write(K.cursor.move(0,a.length-o-1));return}else if(t.lines.length>1){if(r<i)o=r;else{let l=o-i;l>0&&this.output.write(K.cursor.move(0,l))}this.output.write(K.erase.down());let a=e.split(`
|
|
15
15
|
`).slice(o);this.output.write(a.join(`
|
|
16
|
-
`)),this._prevFrame=e;return}}this.output.write(
|
|
16
|
+
`)),this._prevFrame=e;return}}this.output.write(K.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};bt=class extends ne{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#i="";#e;#n;#a;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return Ce(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let e=this.userInput.slice(0,this._cursor),[t,...s]=this.userInput.slice(this._cursor);return`${e}${Ce("inverse",t)}${s.join("")}`}get options(){return typeof this.#n=="function"?this.#n():this.#n}constructor(e){super(e),this.#n=e.options,this.#a=e.placeholder;let t=this.options;this.filteredOptions=[...t],this.multiple=e.multiple===!0,this.#e=typeof e.options=="function"?e.filter:e.filter??Gr;let s;if(e.initialValue&&Array.isArray(e.initialValue)?this.multiple?s=e.initialValue:s=e.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(s=[this.options[0].value]),s)for(let r of s){let i=t.findIndex(o=>o.value===r);i!==-1&&(this.toggleSelected(r),this.#t=i)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(r,i)=>this.#s(r,i)),this.on("userInput",r=>this.#r(r))}_isActionKey(e,t){return e===" "||this.multiple&&this.isNavigating&&t.name==="space"&&e!==void 0&&e!==""}#s(e,t){let s=t.name==="up",r=t.name==="down",i=t.name==="return",o=this.userInput===""||this.userInput===" ",a=this.#a,l=this.options,c=a!==void 0&&a!==""&&l.some(u=>!u.disabled&&(this.#e?this.#e(a,u):!0));if(t.name==="tab"&&o&&c){this.userInput===" "&&this._clearUserInput(),this._setUserInput(a,!0),this.isNavigating=!1;return}s||r?(this.#t=oe(this.#t,s?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):i?this.value=jr(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(t.name==="tab"||this.isNavigating&&t.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(e){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(e)?this.selectedValues=this.selectedValues.filter(t=>t!==e):this.selectedValues=[...this.selectedValues,e]:this.selectedValues=[e])}#r(e){if(e!==this.#i){this.#i=e;let t=this.options;e&&this.#e?this.filteredOptions=t.filter(i=>this.#e?.(e,i)):this.filteredOptions=[...t];let s=Ur(this.focusedValue,this.filteredOptions);this.#t=oe(s,0,this.filteredOptions);let r=this.filteredOptions[this.#t];r&&!r.disabled?this.focusedValue=r.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},De=class extends ne{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",s=>{this.output.write(K.cursor.move(0,-1)),this.value=s,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Wr={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};Ve=class extends ne{#t;#i;#e;#n;#a;#s={segmentIndex:0,positionInSegment:0};#r=!0;#o=null;inlineError="";get segmentCursor(){return{...this.#s}}get segmentValues(){return{...this.#e}}get segments(){return this.#t}get separator(){return this.#i}get formattedValue(){return this.#h(this.#e)}#h(t){return this.#t.map(s=>t[s.type]).join(this.#i)}#c(){this._setUserInput(this.#h(this.#e)),this._setValue(us(this.#e)??void 0)}constructor(t){let s=t.format?{segments:ls(t.format),separator:t.separator??"/"}:qr(t.locale),r=t.separator??s.separator,i=t.format?ls(t.format):s.segments,o=t.initialValue??t.defaultValue,a=o?{year:String(o.getUTCFullYear()).padStart(4,"0"),month:String(o.getUTCMonth()+1).padStart(2,"0"),day:String(o.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},l=i.map(c=>a[c.type]).join(r);super({...t,initialUserInput:l},!1),this.#t=i,this.#i=r,this.#e=a,this.#n=t.minDate,this.#a=t.maxDate,this.#c(),this.on("cursor",c=>this.#p(c)),this.on("key",(c,u)=>this.#g(c,u)),this.on("finalize",()=>this.#f(t))}#l(){let t=Math.max(0,Math.min(this.#s.segmentIndex,this.#t.length-1)),s=this.#t[t];if(s)return this.#s.positionInSegment=Math.max(0,Math.min(this.#s.positionInSegment,s.len-1)),{segment:s,index:t}}#u(t){this.inlineError="",this.#o=null;let s=this.#l();s&&(this.#s.segmentIndex=Math.max(0,Math.min(this.#t.length-1,s.index+t)),this.#s.positionInSegment=0,this.#r=!0)}#d(t){let s=this.#l();if(!s)return;let{segment:r}=s,i=this.#e[r.type],o=!i||i.replace(/_/g,"")==="",a=Number.parseInt((i||"0").replace(/_/g,"0"),10)||0,l=Hr(r.type,Ne(this.#e),this.#n,this.#a),c;o?c=t===1?l.min:l.max:c=Math.max(Math.min(l.max,a+t),l.min),this.#e={...this.#e,[r.type]:c.toString().padStart(r.len,"0")},this.#r=!0,this.#o=null,this.#c()}#p(t){if(t)switch(t){case"right":return this.#u(1);case"left":return this.#u(-1);case"up":return this.#d(1);case"down":return this.#d(-1)}}#g(t,s){if(s?.name==="backspace"||s?.sequence==="\x7F"||s?.sequence==="\b"||t==="\x7F"||t==="\b"){this.inlineError="";let r=this.#l();if(!r)return;if(!this.#e[r.segment.type].replace(/_/g,"")){this.#u(-1);return}this.#e[r.segment.type]="_".repeat(r.segment.len),this.#r=!0,this.#s.positionInSegment=0,this.#c();return}if(s?.name==="tab"){this.inlineError="";let r=this.#l();if(!r)return;let i=s.shift?-1:1,o=r.index+i;o>=0&&o<this.#t.length&&(this.#s.segmentIndex=o,this.#s.positionInSegment=0,this.#r=!0);return}if(t&&/^[0-9]$/.test(t)){let r=this.#l();if(!r)return;let{segment:i}=r,o=!this.#e[i.type].replace(/_/g,"");if(this.#r&&this.#o!==null&&!o){let y=this.#o+t,m={...this.#e,[i.type]:y},b=this.#m(m,i);if(b){this.inlineError=b,this.#o=null,this.#r=!1;return}this.inlineError="",this.#e[i.type]=y,this.#o=null,this.#r=!1,this.#c(),r.index<this.#t.length-1&&(this.#s.segmentIndex=r.index+1,this.#s.positionInSegment=0,this.#r=!0);return}this.#r&&!o&&(this.#e[i.type]="_".repeat(i.len),this.#s.positionInSegment=0),this.#r=!1,this.#o=null;let a=this.#e[i.type],l=a.indexOf("_"),c=l>=0?l:Math.min(this.#s.positionInSegment,i.len-1);if(c<0||c>=i.len)return;let u=a.slice(0,c)+t+a.slice(c+1),d=!1;if(c===0&&a==="__"&&(i.type==="month"||i.type==="day")){let y=Number.parseInt(t,10);u=`0${t}`,d=y<=(i.type==="month"?1:2)}if(i.type==="year"&&(u=(a.replace(/_/g,"")+t).padStart(i.len,"_")),!u.includes("_")){let y={...this.#e,[i.type]:u},m=this.#m(y,i);if(m){this.inlineError=m;return}}this.inlineError="",this.#e[i.type]=u;let g=u.includes("_")?void 0:ps(this.#e);if(g){let{year:y,month:m}=g,b=ft(y,m);this.#e={year:String(Math.max(0,Math.min(9999,y))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,m))).padStart(2,"0"),day:String(Math.max(1,Math.min(b,g.day))).padStart(2,"0")}}this.#c();let p=u.indexOf("_");d?(this.#r=!0,this.#o=t):p>=0?this.#s.positionInSegment=p:l>=0&&r.index<this.#t.length-1?(this.#s.segmentIndex=r.index+1,this.#s.positionInSegment=0,this.#r=!0):this.#s.positionInSegment=Math.min(c+1,i.len-1)}}#m(t,s){let{month:r,day:i}=Ne(t);if(s.type==="month"&&(r<0||r>12))return I.date.messages.invalidMonth;if(s.type==="day"&&(i<0||i>31))return I.date.messages.invalidDay(31,"any month")}#f(t){let{year:s,month:r,day:i}=Ne(this.#e);if(s&&r&&i){let o=ft(s,r);this.#e={...this.#e,day:String(Math.min(i,o)).padStart(2,"0")}}this.value=us(this.#e)??t.defaultValue??void 0}},Ue=class extends ne{options;cursor=0;#t;getGroupItems(t){return this.options.filter(s=>s.group===t)}isGroupSelected(t){let s=this.getGroupItems(t),r=this.value;return r===void 0?!1:s.every(i=>r.includes(i.value))}toggleValue(){let t=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),t.group===!0){let s=t.value,r=this.getGroupItems(s);this.isGroupSelected(s)?this.value=this.value.filter(i=>r.findIndex(o=>o.value===i)===-1):this.value=[...this.value,...r.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{let s=this.value.includes(t.value);this.value=s?this.value.filter(r=>r!==t.value):[...this.value,t.value]}}constructor(t){super(t,!1);let{options:s}=t;this.#t=t.selectableGroups!==!1,this.options=Object.entries(s).flatMap(([r,i])=>[{value:r,group:!0,label:r},...i.map(o=>({...o,group:r}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:r})=>r===t.cursorAt),this.#t?0:1),this.on("cursor",r=>{switch(r){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let i=this.options[this.cursor]?.group===!0;!this.#t&&i&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let i=this.options[this.cursor]?.group===!0;!this.#t&&i&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},Ge=class extends ne{#t=!1;#i;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${t}\u2588`;let s=t.slice(0,this.cursor),r=t[this.cursor],i=t.slice(this.cursor+1);return r===`
|
|
17
17
|
`?`${s}\u2588
|
|
18
|
-
${i}`:`${s}${
|
|
18
|
+
${i}`:`${s}${Ce("inverse",r)}${i}`}get cursor(){return this._cursor}#e(t){if(this.userInput.length===0){this._setUserInput(t);return}this._setUserInput(this.userInput.slice(0,this.cursor)+t+this.userInput.slice(this.cursor))}#n(t){let s=this.value??"";switch(t){case"up":this._cursor=Le(this._cursor,0,-1,s);return;case"down":this._cursor=Le(this._cursor,0,1,s);return;case"left":this._cursor=Le(this._cursor,-1,0,s);return;case"right":this._cursor=Le(this._cursor,1,0,s);return}}_shouldSubmit(t,s){if(this.#i)return this.focused==="submit"?!0:(this.#e(`
|
|
19
19
|
`),this._cursor++,!1);let r=this.#t;return this.#t=!0,r?(this.userInput[this.cursor-1]===`
|
|
20
20
|
`&&(this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--),!0):(this.#e(`
|
|
21
|
-
`),this._cursor++,!1)}constructor(t){super(t,!1),this.#i=t.showSubmit??!1,this.on("key",(s,r)=>{if(r?.name&&I.actions.has(r.name)){this.#n(r.name);return}if(s===" "&&this.#i){this.focused=this.focused==="editor"?"submit":"editor";return}if(r?.name!=="return"){if(this.#t=!1,r?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(r?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}s&&(this.#i&&this.focused==="submit"&&(this.focused="editor"),this.#e(s??""),this._cursor++)}}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}},
|
|
22
|
-
`);$.push(
|
|
21
|
+
`),this._cursor++,!1)}constructor(t){super(t,!1),this.#i=t.showSubmit??!1,this.on("key",(s,r)=>{if(r?.name&&I.actions.has(r.name)){this.#n(r.name);return}if(s===" "&&this.#i){this.focused=this.focused==="editor"?"submit":"editor";return}if(r?.name!=="return"){if(this.#t=!1,r?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(r?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}s&&(this.#i&&this.focused==="submit"&&(this.focused="editor"),this.#e(s??""),this._cursor++)}}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}},gs=class extends ne{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(s=>s.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(s=>!e.includes(s.value));this.value=t.map(s=>s.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(t=>t!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:s})=>s===e.cursorAt),0);this.cursor=this.options[t].disabled?oe(t,1,this.options):t,this.on("key",s=>{s==="a"&&this.toggleAll(),s==="i"&&this.toggleInvert()}),this.on("cursor",s=>{switch(s){case"left":case"up":this.cursor=oe(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=oe(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}},je=class extends ne{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${Ce(["inverse","hidden"],"_")}`;let s=this.masked,r=s.slice(0,this.cursor),i=s.slice(this.cursor);return`${r}${Ce("inverse",i[0])}${i.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...s}){super(s),this._mask=t??"\u2022",this.on("userInput",r=>{this._setValue(r)})}},We=class extends ne{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let s=this.options.findIndex(({value:i})=>i===t.initialValue),r=s===-1?0:s;this.cursor=this.options[r].disabled?oe(r,1,this.options):r,this.changeValue(),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=oe(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=oe(this.cursor,1,this.options);break}this.changeValue()})}},qe=class extends ne{options;cursor=0;constructor(t){super(t,!1),this.options=t.options;let s=t.caseSensitive===!0,r=this.options.map(({value:[i]})=>s?i:i?.toLowerCase());this.cursor=Math.max(r.indexOf(t.initialValue),0),this.on("key",(i,o)=>{if(!i)return;let a=s&&o.shift?i.toUpperCase():i;if(!r.includes(a))return;let l=this.options.find(({value:[c]})=>s?c===a:c?.toLowerCase()===i);l&&(this.value=l.value,this.state="submit",this.emit("submit"))})}},He=class extends ne{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let s=t.slice(0,this.cursor),[r,...i]=t.slice(this.cursor);return`${s}${Ce("inverse",r)}${i.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",s=>{this._setValue(s)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}});var Ms={};yr(Ms,{S_BAR:()=>f,S_BAR_END:()=>V,S_BAR_END_RIGHT:()=>xs,S_BAR_H:()=>Ye,S_BAR_START:()=>xt,S_BAR_START_RIGHT:()=>Es,S_CHECKBOX_ACTIVE:()=>Je,S_CHECKBOX_INACTIVE:()=>Ee,S_CHECKBOX_SELECTED:()=>me,S_CONNECT_LEFT:()=>Rs,S_CORNER_BOTTOM_LEFT:()=>_t,S_CORNER_BOTTOM_RIGHT:()=>Rt,S_CORNER_TOP_LEFT:()=>_s,S_CORNER_TOP_RIGHT:()=>Tt,S_ERROR:()=>Ot,S_INFO:()=>At,S_PASSWORD_MASK:()=>Ts,S_RADIO_ACTIVE:()=>Fe,S_RADIO_INACTIVE:()=>pe,S_STEP_ACTIVE:()=>Ss,S_STEP_CANCEL:()=>St,S_STEP_ERROR:()=>Et,S_STEP_SUBMIT:()=>ge,S_SUCCESS:()=>Ft,S_WARN:()=>Mt,autocomplete:()=>Fs,autocompleteMultiselect:()=>Xr,box:()=>si,cancel:()=>Me,confirm:()=>le,date:()=>ri,group:()=>ai,groupMultiselect:()=>ci,intro:()=>kt,isCI:()=>It,isCancel:()=>Ie,isTTY:()=>Is,limitOptions:()=>ce,log:()=>E,multiline:()=>li,multiselect:()=>Pt,note:()=>fe,outro:()=>Lt,password:()=>di,path:()=>mi,progress:()=>gi,select:()=>H,selectKey:()=>fi,settings:()=>I,spinner:()=>$e,stream:()=>de,symbol:()=>J,symbolBar:()=>Bt,taskLog:()=>vi,tasks:()=>$i,text:()=>ue,unicode:()=>ze,unicodeOr:()=>_,updateSettings:()=>ds});import{styleText as n,stripVTControlCharacters as Ct}from"node:util";import X from"node:process";import{existsSync as Kr,lstatSync as fs,readdirSync as zr}from"node:fs";import{dirname as $s,join as Jr}from"node:path";function Yr(){return X.platform!=="win32"?X.env.TERM!=="linux":!!X.env.CI||!!X.env.WT_SESSION||!!X.env.TERMINUS_SUBLIME||X.env.ConEmuTask==="{cmd::Cmder}"||X.env.TERM_PROGRAM==="Terminus-Sublime"||X.env.TERM_PROGRAM==="vscode"||X.env.TERM==="xterm-256color"||X.env.TERM==="alacritty"||X.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function vs(e){return e.label??String(e.value??"")}function As(e,t){if(!e)return!0;let s=(t.label??String(t.value??"")).toLowerCase(),r=(t.hint??"").toLowerCase(),i=String(t.value).toLowerCase(),o=e.toLowerCase();return s.includes(o)||r.includes(o)||i.includes(o)}function Qr(e,t){let s=[];for(let r of t)e.includes(r.value)&&s.push(r);return s}function bs(e,t,s,r){let i=s,o=s;return r==="center"?i=Math.floor((t-e)/2):r==="right"&&(i=t-e-s),o=t-i-e,[i,o]}function ii(e,t){let s=e.segmentValues,r=e.segmentCursor;if(t==="submit"||t==="cancel")return e.formattedValue;let i=n("gray",e.separator);return e.segments.map((o,a)=>{let l=a===r.segmentIndex&&!["submit","cancel"].includes(t),c=oi[o.type];return ni(s[o.type],{isActive:l,label:c})}).join(i)}function ni(e,t){let s=!e||e.replace(/_/g,"")==="";return t.isActive?n("inverse",s?t.label:e.replace(/_/g," ")):s?n("dim",t.label):e.replace(/_/g,n("dim"," "))}function gi({style:e="heavy",max:t=100,size:s=40,...r}={}){let i=$e(r),o=0,a="",l=Math.max(1,t),c=Math.max(1,s),u=y=>{switch(y){case"initial":case"active":return m=>n("magenta",m);case"error":case"cancel":return m=>n("red",m);case"submit":return m=>n("green",m);default:return m=>n("magenta",m)}},d=(y,m)=>{let b=Math.floor(o/l*c);return`${u(y)(ws[e].repeat(b))}${n("dim",ws[e].repeat(c-b))} ${m}`},g=(y="")=>{a=y,i.start(d("initial",y))},p=(y=1,m)=>{o=Math.min(l,y+o),i.message(d("active",m??a)),a=m??a};return{start:g,stop:i.stop,cancel:i.cancel,error:i.error,clear:i.clear,advance:p,isCancelled:i.isCancelled,message:y=>p(0,y)}}var Se,ze,It,Is,_,Ss,St,Et,ge,xt,f,V,Es,xs,Fe,pe,Je,me,Ee,Ts,Ye,Tt,Rs,Rt,_t,_s,At,Ft,Mt,Ot,J,Bt,ys,ce,Fs,Xr,Zr,ei,ti,si,le,ri,oi,ai,ci,E,Me,kt,Lt,li,Ae,Pt,ui,hi,fe,di,mi,pi,$e,ws,Ke,H,fi,Cs,de,$i,yi,vi,ue,Z=we(()=>{wt();wt();ut();ot();Se=Wt(mt(),1);ze=Yr(),It=()=>process.env.CI==="true",Is=e=>e.isTTY===!0,_=(e,t)=>ze?e:t,Ss=_("\u25C6","*"),St=_("\u25A0","x"),Et=_("\u25B2","x"),ge=_("\u25C7","o"),xt=_("\u250C","T"),f=_("\u2502","|"),V=_("\u2514","\u2014"),Es=_("\u2510","T"),xs=_("\u2518","\u2014"),Fe=_("\u25CF",">"),pe=_("\u25CB"," "),Je=_("\u25FB","[\u2022]"),me=_("\u25FC","[+]"),Ee=_("\u25FB","[ ]"),Ts=_("\u25AA","\u2022"),Ye=_("\u2500","-"),Tt=_("\u256E","+"),Rs=_("\u251C","+"),Rt=_("\u256F","+"),_t=_("\u2570","+"),_s=_("\u256D","+"),At=_("\u25CF","\u2022"),Ft=_("\u25C6","*"),Mt=_("\u25B2","!"),Ot=_("\u25A0","x"),J=e=>{switch(e){case"initial":case"active":return n("cyan",Ss);case"cancel":return n("red",St);case"error":return n("yellow",Et);case"submit":return n("green",ge)}},Bt=e=>{switch(e){case"initial":case"active":return n("cyan",f);case"cancel":return n("red",f);case"error":return n("yellow",f);case"submit":return n("green",f)}},ys=(e,t,s,r,i,o=!1)=>{let a=t,l=0;if(o)for(let c=r-1;c>=s&&(a-=e[c].length,l++,!(a<=i));c--);else for(let c=s;c<r&&(a-=e[c].length,l++,!(a<=i));c++);return{lineCount:a,removals:l}},ce=({cursor:e,options:t,style:s,output:r=process.stdout,maxItems:i=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:a=4})=>{let l=he(r)-o,c=vt(r),u=n("dim","..."),d=Math.max(c-a,0),g=Math.max(Math.min(i,d),5),p=0;e>=g-3&&(p=Math.max(Math.min(e-g+3,t.length-g),0));let y=g<t.length&&p>0,m=g<t.length&&p+g<t.length,b=Math.min(p+g,t.length),$=[],v=0;y&&v++,m&&v++;let C=p+(y?1:0),T=b-(m?1:0);for(let x=C;x<T;x++){let L=se(s(t[x],x===e),l,{hard:!0,trim:!1}).split(`
|
|
22
|
+
`);$.push(L),v+=L.length}if(v>d){let x=0,L=0,M=v,k=e-C,N=d,W=()=>ys($,M,0,k,N),w=()=>ys($,M,k+1,$.length,N,!0);y?({lineCount:M,removals:x}=W(),M>N&&(m||(N-=1),{lineCount:M,removals:L}=w())):(m||(N-=1),{lineCount:M,removals:L}=w(),M>N&&(N-=1,{lineCount:M,removals:x}=W())),x>0&&(y=!0,$.splice(0,x)),L>0&&(m=!0,$.splice($.length-L,L))}let R=[];y&&R.push(u);for(let x of $)for(let L of x)R.push(L);return m&&R.push(u),R};Fs=e=>new bt({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,placeholder:e.placeholder,filter:e.filter??((t,s)=>As(t,s)),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){let t=e.withGuide??I.withGuide,s=t?[`${n("gray",f)}`,`${J(this.state)} ${e.message}`]:[`${J(this.state)} ${e.message}`],r=this.userInput,i=this.options,o=e.placeholder,a=r===""&&o!==void 0,l=(c,u)=>{let d=vs(c),g=c.hint&&c.value===this.focusedValue?n("dim",` (${c.hint})`):"";switch(u){case"active":return`${n("green",Fe)} ${d}${g}`;case"inactive":return`${n("dim",pe)} ${n("dim",d)}`;case"disabled":return`${n("gray",pe)} ${n(["strikethrough","gray"],d)}`}};switch(this.state){case"submit":{let c=Qr(this.selectedValues,i),u=c.length>0?` ${n("dim",c.map(vs).join(", "))}`:"",d=t?n("gray",f):"";return`${s.join(`
|
|
23
23
|
`)}
|
|
24
|
-
${d}${
|
|
24
|
+
${d}${u}`}case"cancel":{let c=r?` ${n(["strikethrough","dim"],r)}`:"",u=t?n("gray",f):"";return`${s.join(`
|
|
25
25
|
`)}
|
|
26
|
-
${
|
|
27
|
-
`)}}}}).prompt(),
|
|
26
|
+
${u}${c}`}default:{let c=this.state==="error"?"yellow":"cyan",u=t?`${n(c,f)} `:"",d=t?n(c,V):"",g="";if(this.isNavigating||a){let C=a?o:r;g=C!==""?` ${n("dim",C)}`:""}else g=` ${this.userInputWithCursor}`;let p=this.filteredOptions.length!==i.length?n("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",y=this.filteredOptions.length===0&&r?[`${u}${n("yellow","No matches found")}`]:[],m=this.state==="error"?[`${u}${n("yellow",this.error)}`]:[];t&&s.push(`${u.trimEnd()}`),s.push(`${u}${n("dim","Search:")}${g}${p}`,...y,...m);let b=[`${n("dim","\u2191/\u2193")} to select`,`${n("dim","Enter:")} confirm`,`${n("dim","Type:")} to search`],$=[`${u}${b.join(" \u2022 ")}`,d],v=this.filteredOptions.length===0?[]:ce({cursor:this.cursor,options:this.filteredOptions,columnPadding:t?3:0,rowPadding:s.length+$.length,style:(C,T)=>l(C,C.disabled?"disabled":T?"active":"inactive"),maxItems:e.maxItems,output:e.output});return[...s,...v.map(C=>`${u}${C}`),...$].join(`
|
|
27
|
+
`)}}}}).prompt(),Xr=e=>{let t=(r,i,o,a)=>{let l=o.includes(r.value),c=r.label??String(r.value??""),u=r.hint&&a!==void 0&&r.value===a?n("dim",` (${r.hint})`):"",d=l?n("green",me):n("dim",Ee);return r.disabled?`${n("gray",Ee)} ${n(["strikethrough","gray"],c)}`:i?`${d} ${c}${u}`:`${d} ${n("dim",c)}`},s=new bt({options:e.options,multiple:!0,placeholder:e.placeholder,filter:e.filter??((r,i)=>As(r,i)),validate:()=>{if(e.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){let r=e.withGuide??I.withGuide,i=`${r?`${n("gray",f)}
|
|
28
28
|
`:""}${J(this.state)} ${e.message}
|
|
29
|
-
`,o=this.userInput,a=e.placeholder,
|
|
30
|
-
`),`${p}${n("dim","Search:")} ${c}${d}`,...b,...$],C=[`${p}${m.join(" \u2022 ")}`,y],T=
|
|
31
|
-
`)}}}});return s.prompt()},
|
|
32
|
-
`),W=b+a*2;for(let
|
|
29
|
+
`,o=this.userInput,a=e.placeholder,l=o===""&&a!==void 0,c=this.isNavigating||l?n("dim",l?a:o):this.userInputWithCursor,u=this.options,d=this.filteredOptions.length!==u.length?n("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${r?`${n("gray",f)} `:""}${n("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${r?`${n("gray",f)} `:""}${n(["strikethrough","dim"],o)}`;default:{let g=this.state==="error"?"yellow":"cyan",p=r?`${n(g,f)} `:"",y=r?n(g,V):"",m=[`${n("dim","\u2191/\u2193")} to navigate`,`${n("dim",this.isNavigating?"Space/Tab:":"Tab:")} select`,`${n("dim","Enter:")} confirm`,`${n("dim","Type:")} to search`],b=this.filteredOptions.length===0&&o?[`${p}${n("yellow","No matches found")}`]:[],$=this.state==="error"?[`${p}${n("yellow",this.error)}`]:[],v=[...`${i}${r?n(g,f):""}`.split(`
|
|
30
|
+
`),`${p}${n("dim","Search:")} ${c}${d}`,...b,...$],C=[`${p}${m.join(" \u2022 ")}`,y],T=ce({cursor:this.cursor,options:this.filteredOptions,style:(R,x)=>t(R,x,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output,rowPadding:v.length+C.length});return[...v,...T.map(R=>`${p}${R}`),...C].join(`
|
|
31
|
+
`)}}}});return s.prompt()},Zr=[_s,Tt,_t,Rt],ei=[xt,Es,V,xs];ti=e=>e,si=(e="",t="",s)=>{let r=s?.output??process.stdout,i=he(r),o=2,a=s?.titlePadding??1,l=s?.contentPadding??2,c=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),u=s?.withGuide??I.withGuide?`${f} `:"",d=s?.formatBorder??ti,g=(s?.rounded?Zr:ei).map(d),p=d(Ye),y=d(f),m=j(u),b=j(t),$=i-m,v=Math.floor(i*c)-m;if(s?.width==="auto"){let N=e.split(`
|
|
32
|
+
`),W=b+a*2;for(let O of N){let q=j(O)+l*2;q>W&&(W=q)}let w=W+o;w<v&&(v=w)}v%2!==0&&(v<$?v++:v--);let C=v-o,T=C-a*2,R=b>T?`${t.slice(0,T-3)}...`:t,[x,L]=bs(j(R),C,a,s?.titleAlign),M=se(e,C-l*2,{hard:!0,trim:!1});r.write(`${u}${g[0]}${p.repeat(x)}${R}${p.repeat(L)}${g[1]}
|
|
33
33
|
`);let k=M.split(`
|
|
34
|
-
`);for(let N of k){let[W,w]=
|
|
35
|
-
`)}r.write(`${
|
|
36
|
-
`)},
|
|
34
|
+
`);for(let N of k){let[W,w]=bs(j(N),C,l,s?.contentAlign);r.write(`${u}${y}${" ".repeat(W)}${N}${" ".repeat(w)}${y}
|
|
35
|
+
`)}r.write(`${u}${g[2]}${p.repeat(C)}${g[3]}
|
|
36
|
+
`)},le=e=>{let t=e.active??"Yes",s=e.inactive??"No";return new De({active:t,inactive:s,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=e.withGuide??I.withGuide,i=`${J(this.state)} `,o=r?`${n("gray",f)} `:"",a=G(e.output,e.message,o,i),l=`${r?`${n("gray",f)}
|
|
37
37
|
`:""}${a}
|
|
38
|
-
`,c=this.value?t:s;switch(this.state){case"submit":{let
|
|
39
|
-
${n("gray",f)}`:""}`}default:{let
|
|
38
|
+
`,c=this.value?t:s;switch(this.state){case"submit":{let u=r?`${n("gray",f)} `:"";return`${l}${u}${n("dim",c)}`}case"cancel":{let u=r?`${n("gray",f)} `:"";return`${l}${u}${n(["strikethrough","dim"],c)}${r?`
|
|
39
|
+
${n("gray",f)}`:""}`}default:{let u=r?`${n("cyan",f)} `:"",d=r?n("cyan",V):"";return`${l}${u}${this.value?`${n("green",Fe)} ${t}`:`${n("dim",pe)} ${n("dim",t)}`}${e.vertical?r?`
|
|
40
40
|
${n("cyan",f)} `:`
|
|
41
|
-
`:` ${n("dim","/")} `}${this.value?`${n("dim",
|
|
41
|
+
`:` ${n("dim","/")} `}${this.value?`${n("dim",pe)} ${n("dim",s)}`:`${n("green",Fe)} ${s}`}
|
|
42
42
|
${d}
|
|
43
|
-
`}}}}).prompt()},
|
|
43
|
+
`}}}}).prompt()},ri=e=>{let t=e.validate;return new Ve({...e,validate(s){if(s===void 0)return e.defaultValue!==void 0?void 0:t?t(s):I.date.messages.required;let r=i=>i.toISOString().slice(0,10);if(e.minDate&&r(s)<r(e.minDate))return I.date.messages.afterMin(e.minDate);if(e.maxDate&&r(s)>r(e.maxDate))return I.date.messages.beforeMax(e.maxDate);if(t)return t(s)},render(){let s=(e?.withGuide??I.withGuide)!==!1,r=`${`${s?`${n("gray",f)}
|
|
44
44
|
`:""}${J(this.state)} `}${e.message}
|
|
45
|
-
`,i=this.state!=="initial"?this.state:"active",o=
|
|
45
|
+
`,i=this.state!=="initial"?this.state:"active",o=ii(this,i),a=this.value instanceof Date?this.formattedValue:"";switch(this.state){case"error":{let l=this.error?` ${n("yellow",this.error)}`:"",c=s?`${n("yellow",f)} `:"",u=s?n("yellow",V):"";return`${r.trim()}
|
|
46
46
|
${c}${o}
|
|
47
|
-
${
|
|
48
|
-
`}case"submit":{let
|
|
49
|
-
${c}`:""}`}default:{let
|
|
50
|
-
${
|
|
47
|
+
${u}${l}
|
|
48
|
+
`}case"submit":{let l=a?` ${n("dim",a)}`:"",c=s?n("gray",f):"";return`${r}${c}${l}`}case"cancel":{let l=a?` ${n(["strikethrough","dim"],a)}`:"",c=s?n("gray",f):"";return`${r}${c}${l}${a.trim()?`
|
|
49
|
+
${c}`:""}`}default:{let l=s?`${n("cyan",f)} `:"",c=s?n("cyan",V):"",u=s?`${n("cyan",f)} `:"",d=this.inlineError?`
|
|
50
|
+
${u}${n("yellow",this.inlineError)}`:"";return`${r}${l}${o}${d}
|
|
51
51
|
${c}
|
|
52
|
-
`}}}}).prompt()};
|
|
53
|
-
`.repeat(s)),a==="active")return G(e.output,`${c}${o.hint?` ${n("dim",`(${o.hint})`)}`:""}`,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${n("cyan",
|
|
52
|
+
`}}}}).prompt()};oi={year:"yyyy",month:"mm",day:"dd"},ai=async(e,t)=>{let s={},r=Object.keys(e);for(let i of r){let o=e[i],a=await o({results:s})?.catch(l=>{throw l});if(typeof t?.onCancel=="function"&&Ie(a)){s[i]="canceled",t.onCancel({results:s});continue}s[i]=a}return s},ci=e=>{let{selectableGroups:t=!0,groupSpacing:s=0}=e,r=(o,a,l=[])=>{let c=o.label??String(o.value),u=typeof o.group=="string",d=u&&(l[l.indexOf(o)+1]??{group:!0}),g=u&&d&&d.group===!0,p="",y="";u&&(t?(p=g?`${V} `:`${f} `,y=g?" ":`${f} `):p=" ");let m="";if(s>0&&!u&&(m=`
|
|
53
|
+
`.repeat(s)),a==="active")return G(e.output,`${c}${o.hint?` ${n("dim",`(${o.hint})`)}`:""}`,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${n("cyan",Je)} `,`${m}${n("dim",y)} `);if(a==="group-active")return G(e.output,c,`${m}${p} `,`${m}${p}${n("cyan",Je)} `,`${m}${y} `,$=>n("dim",$));if(a==="group-active-selected")return G(e.output,c,`${m}${p} `,`${m}${p}${n("green",me)} `,`${m}${y} `,$=>n("dim",$));if(a==="selected"){let $=u||t?n("green",me):"";return G(e.output,`${c}${o.hint?` (${o.hint})`:""}`,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${$} `,`${m}${n("dim",y)} `,v=>n("dim",v))}if(a==="cancelled")return`${n(["strikethrough","dim"],c)}`;if(a==="active-selected")return G(e.output,`${c}${o.hint?` ${n("dim",`(${o.hint})`)}`:""}`,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${n("green",me)} `,`${m}${n("dim",y)} `);if(a==="submitted")return`${n("dim",c)}`;let b=u||t?n("dim",Ee):"";return G(e.output,c,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${b} `,`${m}${n("dim",y)} `,$=>n("dim",$))},i=e.required??!0;return new Ue({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:i,cursorAt:e.cursorAt,selectableGroups:t,validate(o){if(i&&(o===void 0||o.length===0))return`Please select at least one option.
|
|
54
54
|
${n("reset",n("dim",`Press ${n(["gray","bgWhite","inverse"]," space ")} to select, ${n("gray",n(["bgWhite","inverse"]," enter "))} to submit`))}`},render(){let o=e.withGuide??I.withGuide,a=`${o?`${n("gray",f)}
|
|
55
55
|
`:""}${J(this.state)} ${e.message}
|
|
56
|
-
`,
|
|
57
|
-
${n("gray",f)}`:""}`:""}`}case"error":{let
|
|
56
|
+
`,l=this.value??[],c=(u,d)=>{let g=this.options,p=l.includes(u.value)||u.group===!0&&this.isGroupSelected(`${u.value}`);return!d&&typeof u.group=="string"&&this.options[this.cursor].value===u.group?r(u,p?"group-active-selected":"group-active",g):d&&p?r(u,"active-selected",g):p?r(u,"selected",g):r(u,d?"active":"inactive",g)};switch(this.state){case"submit":{let u=this.options.filter(({value:g})=>l.includes(g)).map(g=>r(g,"submitted")),d=u.length===0?"":` ${u.join(n("dim",", "))}`;return`${a}${o?n("gray",f):""}${d}`}case"cancel":{let u=this.options.filter(({value:d})=>l.includes(d)).map(d=>r(d,"cancelled")).join(n("dim",", "));return`${a}${o?`${n("gray",f)} `:""}${u.trim()?`${u}${o?`
|
|
57
|
+
${n("gray",f)}`:""}`:""}`}case"error":{let u=o?`${n("yellow",f)} `:"",d=this.error.split(`
|
|
58
58
|
`).map((m,b)=>b===0?`${o?`${n("yellow",V)} `:""}${n("yellow",m)}`:` ${m}`).join(`
|
|
59
59
|
`),g=a.split(`
|
|
60
60
|
`).length,p=d.split(`
|
|
61
|
-
`).length+1,y=
|
|
62
|
-
${
|
|
61
|
+
`).length+1,y=ce({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:u.length,rowPadding:g+p,style:c}).join(`
|
|
62
|
+
${u}`);return`${a}${u}${y}
|
|
63
63
|
${d}
|
|
64
|
-
`}default:{let
|
|
65
|
-
`).length,g=(o?1:0)+1,p=
|
|
66
|
-
${
|
|
64
|
+
`}default:{let u=o?`${n("cyan",f)} `:"",d=a.split(`
|
|
65
|
+
`).length,g=(o?1:0)+1,p=ce({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:u.length,rowPadding:d+g,style:c}).join(`
|
|
66
|
+
${u}`);return`${a}${u}${p}
|
|
67
67
|
${o?n("cyan",V):""}
|
|
68
|
-
`}}}}).prompt()},E={message:(e=[],{symbol:t=n("gray",f),secondarySymbol:s=n("gray",f),output:r=process.stdout,spacing:i=1,withGuide:o}={})=>{let a=[],
|
|
69
|
-
`);if(g.length>0){let[p,...y]=g;p.length>0?a.push(`${
|
|
68
|
+
`}}}}).prompt()},E={message:(e=[],{symbol:t=n("gray",f),secondarySymbol:s=n("gray",f),output:r=process.stdout,spacing:i=1,withGuide:o}={})=>{let a=[],l=o??I.withGuide,c=l?s:"",u=l?`${t} `:"",d=l?`${s} `:"";for(let p=0;p<i;p++)a.push(c);let g=Array.isArray(e)?e:e.split(`
|
|
69
|
+
`);if(g.length>0){let[p,...y]=g;p.length>0?a.push(`${u}${p}`):a.push(l?t:"");for(let m of y)m.length>0?a.push(`${d}${m}`):a.push(l?s:"")}r.write(`${a.join(`
|
|
70
70
|
`)}
|
|
71
|
-
`)},info:(e,t)=>{E.message(e,{...t,symbol:n("blue",
|
|
71
|
+
`)},info:(e,t)=>{E.message(e,{...t,symbol:n("blue",At)})},success:(e,t)=>{E.message(e,{...t,symbol:n("green",Ft)})},step:(e,t)=>{E.message(e,{...t,symbol:n("green",ge)})},warn:(e,t)=>{E.message(e,{...t,symbol:n("yellow",Mt)})},warning:(e,t)=>{E.warn(e,t)},error:(e,t)=>{E.message(e,{...t,symbol:n("red",Ot)})}},Me=(e="",t)=>{let s=t?.output??process.stdout,r=t?.withGuide??I.withGuide?`${n("gray",V)} `:"";s.write(`${r}${n("red",e)}
|
|
72
72
|
|
|
73
|
-
`)},
|
|
74
|
-
`)},
|
|
73
|
+
`)},kt=(e="",t)=>{let s=t?.output??process.stdout,r=t?.withGuide??I.withGuide?`${n("gray",xt)} `:"";s.write(`${r}${e}
|
|
74
|
+
`)},Lt=(e="",t)=>{let s=t?.output??process.stdout,r=t?.withGuide??I.withGuide?`${n("gray",f)}
|
|
75
75
|
${n("gray",V)} `:"";s.write(`${r}${e}
|
|
76
76
|
|
|
77
|
-
`)},
|
|
77
|
+
`)},li=e=>new Ge({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,showSubmit:e.showSubmit,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??I.withGuide,s=`${`${t?`${n("gray",f)}
|
|
78
78
|
`:""}${J(this.state)} `}${e.message}
|
|
79
79
|
`,r=e.placeholder?n("inverse",e.placeholder[0])+n("dim",e.placeholder.slice(1)):n(["inverse","hidden"],"_"),i=this.userInput?this.userInputWithCursor:r,o=this.value??"",a=e.showSubmit?`
|
|
80
|
-
${n(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{let
|
|
81
|
-
${
|
|
82
|
-
`}case"submit":{let
|
|
80
|
+
${n(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{let l=`${n("yellow",f)} `,c=t?G(e.output,i,l,void 0):i,u=n("yellow",V);return`${s}${c}
|
|
81
|
+
${u} ${n("yellow",this.error)}${a}
|
|
82
|
+
`}case"submit":{let l=`${n("gray",f)} `,c=t?G(e.output,o,l,void 0,void 0,u=>n("dim",u)):o?n("dim",o):"";return`${s}${c}`}case"cancel":{let l=`${n("gray",f)} `,c=t?G(e.output,o,l,void 0,void 0,u=>n(["strikethrough","dim"],u)):o?n(["strikethrough","dim"],o):"";return`${s}${c}`}default:{let l=t?`${n("cyan",f)} `:"",c=t?n("cyan",V):"",u=t?G(e.output,i,l):i;return`${s}${u}
|
|
83
83
|
${c}${a}
|
|
84
|
-
`}}}}).prompt(),
|
|
84
|
+
`}}}}).prompt(),Ae=(e,t)=>e.split(`
|
|
85
85
|
`).map(s=>t(s)).join(`
|
|
86
|
-
`),
|
|
87
|
-
${n("reset",n("dim",`Press ${n(["gray","bgWhite","inverse"]," space ")} to select, ${n("gray",n("bgWhite",n("inverse"," enter ")))} to submit`))}`},render(){let r=e.withGuide??I.withGuide,i=G(e.output,e.message,r?`${
|
|
86
|
+
`),Pt=e=>{let t=(r,i)=>{let o=r.label??String(r.value);return i==="disabled"?`${n("gray",Ee)} ${Ae(o,a=>n(["strikethrough","gray"],a))}${r.hint?` ${n("dim",`(${r.hint??"disabled"})`)}`:""}`:i==="active"?`${n("cyan",Je)} ${o}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`:i==="selected"?`${n("green",me)} ${Ae(o,a=>n("dim",a))}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`:i==="cancelled"?`${Ae(o,a=>n(["strikethrough","dim"],a))}`:i==="active-selected"?`${n("green",me)} ${o}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`:i==="submitted"?`${Ae(o,a=>n("dim",a))}`:`${n("dim",Ee)} ${Ae(o,a=>n("dim",a))}`},s=e.required??!0;return new gs({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:s,cursorAt:e.cursorAt,validate(r){if(s&&(r===void 0||r.length===0))return`Please select at least one option.
|
|
87
|
+
${n("reset",n("dim",`Press ${n(["gray","bgWhite","inverse"]," space ")} to select, ${n("gray",n("bgWhite",n("inverse"," enter ")))} to submit`))}`},render(){let r=e.withGuide??I.withGuide,i=G(e.output,e.message,r?`${Bt(this.state)} `:"",`${J(this.state)} `),o=`${r?`${n("gray",f)}
|
|
88
88
|
`:""}${i}
|
|
89
|
-
`,a=this.value??[],
|
|
90
|
-
${n("gray",f)}`:""}`}case"error":{let c=r?`${n("yellow",f)} `:"",
|
|
89
|
+
`,a=this.value??[],l=(c,u)=>{if(c.disabled)return t(c,"disabled");let d=a.includes(c.value);return u&&d?t(c,"active-selected"):d?t(c,"selected"):t(c,u?"active":"inactive")};switch(this.state){case"submit":{let c=this.options.filter(({value:d})=>a.includes(d)).map(d=>t(d,"submitted")).join(n("dim",", "))||n("dim","none"),u=G(e.output,c,r?`${n("gray",f)} `:"");return`${o}${u}`}case"cancel":{let c=this.options.filter(({value:d})=>a.includes(d)).map(d=>t(d,"cancelled")).join(n("dim",", "));if(c.trim()==="")return`${o}${n("gray",f)}`;let u=G(e.output,c,r?`${n("gray",f)} `:"");return`${o}${u}${r?`
|
|
90
|
+
${n("gray",f)}`:""}`}case"error":{let c=r?`${n("yellow",f)} `:"",u=this.error.split(`
|
|
91
91
|
`).map((p,y)=>y===0?`${r?`${n("yellow",V)} `:""}${n("yellow",p)}`:` ${p}`).join(`
|
|
92
92
|
`),d=o.split(`
|
|
93
|
-
`).length,g=
|
|
94
|
-
`).length+1;return`${o}${c}${
|
|
93
|
+
`).length,g=u.split(`
|
|
94
|
+
`).length+1;return`${o}${c}${ce({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:d+g,style:l}).join(`
|
|
95
95
|
${c}`)}
|
|
96
|
-
${
|
|
97
|
-
`}default:{let c=r?`${n("cyan",f)} `:"",
|
|
98
|
-
`).length,d=r?2:1;return`${o}${c}${
|
|
96
|
+
${u}
|
|
97
|
+
`}default:{let c=r?`${n("cyan",f)} `:"",u=o.split(`
|
|
98
|
+
`).length,d=r?2:1;return`${o}${c}${ce({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:u+d,style:l}).join(`
|
|
99
99
|
${c}`)}
|
|
100
100
|
${r?n("cyan",V):""}
|
|
101
|
-
`}}}}).prompt()},ui=e=>n("dim",e),
|
|
102
|
-
`),o=i.reduce((c,
|
|
103
|
-
`).map(o),""],
|
|
101
|
+
`}}}}).prompt()},ui=e=>n("dim",e),hi=(e,t,s)=>{let r={hard:!0,trim:!1},i=se(e,t,r).split(`
|
|
102
|
+
`),o=i.reduce((c,u)=>Math.max(j(u),c),0),a=i.map(s).reduce((c,u)=>Math.max(j(u),c),0),l=t-(a-o);return se(e,l,r)},fe=(e="",t="",s)=>{let r=s?.output??X.stdout,i=s?.withGuide??I.withGuide,o=s?.format??ui,a=["",...hi(e,he(r)-6,o).split(`
|
|
103
|
+
`).map(o),""],l=j(t),c=Math.max(a.reduce((p,y)=>{let m=j(y);return m>p?m:p},0),l)+2,u=a.map(p=>`${n("gray",f)} ${p}${" ".repeat(c-j(p))}${n("gray",f)}`).join(`
|
|
104
104
|
`),d=i?`${n("gray",f)}
|
|
105
|
-
`:"",g=i?
|
|
106
|
-
${
|
|
107
|
-
${n("gray",g+
|
|
108
|
-
`)},
|
|
105
|
+
`:"",g=i?Rs:_t;r.write(`${d}${n("green",ge)} ${n("reset",t)} ${n("gray",Ye.repeat(Math.max(c-l-1,1))+Tt)}
|
|
106
|
+
${u}
|
|
107
|
+
${n("gray",g+Ye.repeat(c+2)+Rt)}
|
|
108
|
+
`)},di=e=>new je({validate:e.validate,mask:e.mask??Ts,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??I.withGuide,s=`${t?`${n("gray",f)}
|
|
109
109
|
`:""}${J(this.state)} ${e.message}
|
|
110
|
-
`,r=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let o=t?`${n("yellow",f)} `:"",a=t?`${n("yellow",V)} `:"",
|
|
111
|
-
${o}${
|
|
110
|
+
`,r=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let o=t?`${n("yellow",f)} `:"",a=t?`${n("yellow",V)} `:"",l=i??"";return e.clearOnError&&this.clear(),`${s.trim()}
|
|
111
|
+
${o}${l}
|
|
112
112
|
${a}${n("yellow",this.error)}
|
|
113
113
|
`}case"submit":{let o=t?`${n("gray",f)} `:"",a=i?n("dim",i):"";return`${s}${o}${a}`}case"cancel":{let o=t?`${n("gray",f)} `:"",a=i?n(["strikethrough","dim"],i):"";return`${s}${o}${a}${i&&t?`
|
|
114
114
|
${n("gray",f)}`:""}`}default:{let o=t?`${n("cyan",f)} `:"",a=t?n("cyan",V):"";return`${s}${o}${r}
|
|
115
115
|
${a}
|
|
116
|
-
`}}}}).prompt(),
|
|
116
|
+
`}}}}).prompt(),mi=e=>{let t=e.validate;return Fs({...e,initialUserInput:e.initialValue??e.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(t)return t(s)}},options(){let s=this.userInput;if(s==="")return[];try{let r;Kr(s)?fs(s).isDirectory()&&(!e.directory||s.endsWith("/"))?r=s:r=$s(s):r=$s(s);let i=s.length>1&&s.endsWith("/")?s.slice(0,-1):s;return zr(r).map(o=>{let a=Jr(r,o),l=fs(a);return{name:o,path:a,isDirectory:l.isDirectory()}}).filter(({path:o,isDirectory:a})=>o.startsWith(i)&&(a||!e.directory)).map(o=>({value:o.path}))}catch{return[]}}})},pi=e=>n("magenta",e),$e=({indicator:e="dots",onCancel:t,output:s=process.stdout,cancelMessage:r,errorMessage:i,frames:o=ze?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=ze?80:120,signal:l,...c}={})=>{let u=It(),d,g,p=!1,y=!1,m="",b,$=performance.now(),v=he(s),C=c?.styleFrame??pi,T=S=>{let B=S>1?i??I.messages.error:r??I.messages.cancel;y=S===1,p&&(q(B,S),y&&typeof t=="function"&&t())},R=()=>T(2),x=()=>T(1),L=()=>{process.on("uncaughtExceptionMonitor",R),process.on("unhandledRejection",R),process.on("SIGINT",x),process.on("SIGTERM",x),process.on("exit",T),l&&l.addEventListener("abort",x)},M=()=>{process.removeListener("uncaughtExceptionMonitor",R),process.removeListener("unhandledRejection",R),process.removeListener("SIGINT",x),process.removeListener("SIGTERM",x),process.removeListener("exit",T),l&&l.removeEventListener("abort",x)},k=()=>{if(b===void 0)return;u&&s.write(`
|
|
117
117
|
`);let S=se(b,v,{hard:!0,trim:!1}).split(`
|
|
118
|
-
`);S.length>1&&s.write(
|
|
119
|
-
`);let
|
|
120
|
-
`):s.write(`${
|
|
121
|
-
`)),M(),d()};return{start:
|
|
118
|
+
`);S.length>1&&s.write(Se.cursor.up(S.length-1)),s.write(Se.cursor.to(0)),s.write(Se.erase.down())},N=S=>S.replace(/\.+$/,""),W=S=>{let B=(performance.now()-S)/1e3,z=Math.floor(B/60),Q=Math.floor(B%60);return z>0?`[${z}m ${Q}s]`:`[${Q}s]`},w=c.withGuide??I.withGuide,O=(S="")=>{p=!0,d=ms({output:s}),m=N(S),$=performance.now(),w&&s.write(`${n("gray",f)}
|
|
119
|
+
`);let B=0,z=0;L(),g=setInterval(()=>{if(u&&m===b)return;k(),b=m;let Q=C(o[B]),ie;if(u)ie=`${Q} ${m}...`;else if(e==="timer")ie=`${Q} ${m} ${W($)}`;else{let it=".".repeat(Math.floor(z)).slice(0,3);ie=`${Q} ${m}${it}`}let be=se(ie,v,{hard:!0,trim:!1});s.write(be),B=B+1<o.length?B+1:0,z=z<4?z+.125:0},a)},q=(S="",B=0,z=!1)=>{if(!p)return;p=!1,clearInterval(g),k();let Q=B===0?n("green",ge):B===1?n("red",St):n("red",Et);m=S??m,z||(e==="timer"?s.write(`${Q} ${m} ${W($)}
|
|
120
|
+
`):s.write(`${Q} ${m}
|
|
121
|
+
`)),M(),d()};return{start:O,stop:(S="")=>q(S,0),message:(S="")=>{m=N(S??m)},cancel:(S="")=>q(S,1),error:(S="")=>q(S,2),clear:()=>q("",0,!0),get isCancelled(){return y}}},ws={light:_("\u2500","-"),heavy:_("\u2501","="),block:_("\u2588","#")};Ke=(e,t)=>e.includes(`
|
|
122
122
|
`)?e.split(`
|
|
123
123
|
`).map(s=>t(s)).join(`
|
|
124
|
-
`):t(e),
|
|
124
|
+
`):t(e),H=e=>{let t=(s,r)=>{let i=s.label??String(s.value);switch(r){case"disabled":return`${n("gray",pe)} ${Ke(i,o=>n("gray",o))}${s.hint?` ${n("dim",`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${Ke(i,o=>n("dim",o))}`;case"active":return`${n("green",Fe)} ${i}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`;case"cancelled":return`${Ke(i,o=>n(["strikethrough","dim"],o))}`;default:return`${n("dim",pe)} ${Ke(i,o=>n("dim",o))}`}};return new We({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let s=e.withGuide??I.withGuide,r=`${J(this.state)} `,i=`${Bt(this.state)} `,o=G(e.output,e.message,i,r),a=`${s?`${n("gray",f)}
|
|
125
125
|
`:""}${o}
|
|
126
|
-
`;switch(this.state){case"submit":{let
|
|
127
|
-
${n("gray",f)}`:""}`}default:{let
|
|
128
|
-
`).length,d=s?2:1;return`${a}${
|
|
129
|
-
${
|
|
126
|
+
`;switch(this.state){case"submit":{let l=s?`${n("gray",f)} `:"",c=G(e.output,t(this.options[this.cursor],"selected"),l);return`${a}${c}`}case"cancel":{let l=s?`${n("gray",f)} `:"",c=G(e.output,t(this.options[this.cursor],"cancelled"),l);return`${a}${c}${s?`
|
|
127
|
+
${n("gray",f)}`:""}`}default:{let l=s?`${n("cyan",f)} `:"",c=s?n("cyan",V):"",u=a.split(`
|
|
128
|
+
`).length,d=s?2:1;return`${a}${l}${ce({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:l.length,rowPadding:u+d,style:(g,p)=>t(g,g.disabled?"disabled":p?"active":"inactive")}).join(`
|
|
129
|
+
${l}`)}
|
|
130
130
|
${c}
|
|
131
|
-
`}}}}).prompt()},
|
|
131
|
+
`}}}}).prompt()},fi=e=>{let t=(s,r="inactive")=>{let i=s.label??String(s.value);return r==="selected"?`${n("dim",i)}`:r==="cancelled"?`${n(["strikethrough","dim"],i)}`:r==="active"?`${n(["bgCyan","gray"],` ${s.value} `)} ${i}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`:`${n(["gray","bgWhite","inverse"],` ${s.value} `)} ${i}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`};return new qe({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,caseSensitive:e.caseSensitive,render(){let s=e.withGuide??I.withGuide,r=`${s?`${n("gray",f)}
|
|
132
132
|
`:""}${J(this.state)} ${e.message}
|
|
133
|
-
`;switch(this.state){case"submit":{let i=s?`${n("gray",f)} `:"",o=this.options.find(
|
|
134
|
-
${n("gray",f)}`:""}`}default:{let i=s?`${n("cyan",f)} `:"",o=s?n("cyan",V):"",a=this.options.map((
|
|
133
|
+
`;switch(this.state){case"submit":{let i=s?`${n("gray",f)} `:"",o=this.options.find(l=>l.value===this.value)??e.options[0],a=G(e.output,t(o,"selected"),i);return`${r}${a}`}case"cancel":{let i=s?`${n("gray",f)} `:"",o=G(e.output,t(this.options[0],"cancelled"),i);return`${r}${o}${s?`
|
|
134
|
+
${n("gray",f)}`:""}`}default:{let i=s?`${n("cyan",f)} `:"",o=s?n("cyan",V):"",a=this.options.map((l,c)=>G(e.output,t(l,c===this.cursor?"active":"inactive"),i)).join(`
|
|
135
135
|
`);return`${r}${a}
|
|
136
136
|
${o}
|
|
137
|
-
`}}}}).prompt()},
|
|
137
|
+
`}}}}).prompt()},Cs=`${n("gray",f)} `,de={message:async(e,{symbol:t=n("gray",f)}={})=>{process.stdout.write(`${n("gray",f)}
|
|
138
138
|
${t} `);let s=3;for await(let r of e){r=r.replace(/\n/g,`
|
|
139
|
-
${
|
|
140
|
-
`)&&(s=3+
|
|
141
|
-
`))).length);let i=
|
|
142
|
-
${
|
|
143
|
-
`)},info:e=>
|
|
144
|
-
`),t.write(`${n("green",
|
|
139
|
+
${Cs}`),r.includes(`
|
|
140
|
+
`)&&(s=3+Ct(r.slice(r.lastIndexOf(`
|
|
141
|
+
`))).length);let i=Ct(r).length;s+i<process.stdout.columns?(s+=i,process.stdout.write(r)):(process.stdout.write(`
|
|
142
|
+
${Cs}${r.trimStart()}`),s=3+Ct(r.trimStart()).length)}process.stdout.write(`
|
|
143
|
+
`)},info:e=>de.message(e,{symbol:n("blue",At)}),success:e=>de.message(e,{symbol:n("green",Ft)}),step:e=>de.message(e,{symbol:n("green",ge)}),warn:e=>de.message(e,{symbol:n("yellow",Mt)}),warning:e=>de.warn(e),error:e=>de.message(e,{symbol:n("red",Ot)})},$i=async(e,t)=>{for(let s of e){if(s.enabled===!1)continue;let r=$e(t);r.start(s.title);let i=await s.task(r.message);r.stop(i||s.title)}},yi=e=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),vi=e=>{let t=e.output??process.stdout,s=he(t),r=n("gray",f),i=e.spacing??1,o=3,a=e.retainLog===!0,l=!It()&&Is(t);t.write(`${r}
|
|
144
|
+
`),t.write(`${n("green",ge)} ${e.title}
|
|
145
145
|
`);for(let $=0;$<i;$++)t.write(`${r}
|
|
146
|
-
`);let c=[{value:"",full:""}],
|
|
147
|
-
${C.header}`);let
|
|
148
|
-
`).reduce((M,k)=>k===""?M+1:M+Math.ceil((k.length+o)/s),0);v+=
|
|
146
|
+
`);let c=[{value:"",full:""}],u=!1,d=$=>{if(c.length===0)return;let v=0;$&&(v+=i+2);for(let C of c){let{value:T,result:R}=C,x=R?.message??T;if(x.length===0)continue;R===void 0&&C.header!==void 0&&C.header!==""&&(x+=`
|
|
147
|
+
${C.header}`);let L=x.split(`
|
|
148
|
+
`).reduce((M,k)=>k===""?M+1:M+Math.ceil((k.length+o)/s),0);v+=L}v>0&&(v+=1,t.write(Se.erase.lines(v)))},g=($,v,C)=>{let T=C?`${$.full}
|
|
149
149
|
${$.value}`:$.value;$.header!==void 0&&$.header!==""&&E.message($.header.split(`
|
|
150
150
|
`).map(R=>n("bold",R)),{output:t,secondarySymbol:r,symbol:r,spacing:0}),E.message(T.split(`
|
|
151
|
-
`).map(R=>n("dim",R)),{output:t,secondarySymbol:r,symbol:r,spacing:v??i})},p=()=>{for(let $ of c){let{header:v,value:C,full:T}=$;(v===void 0||v.length===0)&&C.length===0||g($,void 0,a===!0&&T.length>0)}},y=($,v,C)=>{if(d(!1),(C?.raw!==!0||!
|
|
152
|
-
`),$.value
|
|
151
|
+
`).map(R=>n("dim",R)),{output:t,secondarySymbol:r,symbol:r,spacing:v??i})},p=()=>{for(let $ of c){let{header:v,value:C,full:T}=$;(v===void 0||v.length===0)&&C.length===0||g($,void 0,a===!0&&T.length>0)}},y=($,v,C)=>{if(d(!1),(C?.raw!==!0||!u)&&$.value!==""&&($.value+=`
|
|
152
|
+
`),$.value+=yi(v),u=C?.raw===!0,e.limit!==void 0){let T=$.value.split(`
|
|
153
153
|
`),R=T.length-e.limit;if(R>0){let x=T.splice(0,R);a&&($.full+=($.full===""?"":`
|
|
154
154
|
`)+x.join(`
|
|
155
155
|
`))}$.value=T.join(`
|
|
156
|
-
`)}
|
|
156
|
+
`)}l&&m()},m=()=>{for(let $ of c)$.result?$.result.status==="error"?E.error($.result.message,{output:t,secondarySymbol:r,spacing:0}):E.success($.result.message,{output:t,secondarySymbol:r,spacing:0}):$.value!==""&&g($,0)},b=($,v)=>{d(!1),$.result=v,l&&m()};return{message($,v){y(c[0],$,v)},group($){let v={header:$,value:"",full:""};return c.push(v),{message(C,T){y(v,C,T)},error(C){b(v,{status:"error",message:C})},success(C){b(v,{status:"success",message:C})}}},error($,v){d(!0),E.error($,{output:t,secondarySymbol:r,spacing:1}),v?.showLog!==!1&&p(),c.splice(1,c.length-1),c[0].value="",c[0].full=""},success($,v){d(!0),E.success($,{output:t,secondarySymbol:r,spacing:1}),v?.showLog===!0&&p(),c.splice(1,c.length-1),c[0].value="",c[0].full=""}}},ue=e=>new He({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??I.withGuide,s=`${`${t?`${n("gray",f)}
|
|
157
157
|
`:""}${J(this.state)} `}${e.message}
|
|
158
|
-
`,r=e.placeholder?n("inverse",e.placeholder[0])+n("dim",e.placeholder.slice(1)):n(["inverse","hidden"],"_"),i=this.userInput?this.userInputWithCursor:r,o=this.value??"";switch(this.state){case"error":{let a=this.error?` ${n("yellow",this.error)}`:"",
|
|
159
|
-
${
|
|
158
|
+
`,r=e.placeholder?n("inverse",e.placeholder[0])+n("dim",e.placeholder.slice(1)):n(["inverse","hidden"],"_"),i=this.userInput?this.userInputWithCursor:r,o=this.value??"";switch(this.state){case"error":{let a=this.error?` ${n("yellow",this.error)}`:"",l=t?`${n("yellow",f)} `:"",c=t?n("yellow",V):"";return`${s.trim()}
|
|
159
|
+
${l}${i}
|
|
160
160
|
${c}${a}
|
|
161
|
-
`}case"submit":{let a=o?` ${n("dim",o)}`:"",
|
|
162
|
-
${
|
|
163
|
-
${
|
|
164
|
-
`}}}}).prompt()});X();X();import{spawnSync as Zs}from"child_process";X();X();import{existsSync as Ms,readFileSync as vi,writeFileSync as bi,mkdirSync as wi}from"fs";import Ci from"os";import Os from"path";var Pt=Os.join(Ci.homedir(),".eazy-git"),Lt=Os.join(Pt,"config.json"),Fs={language:"es",defaultBaseBranch:"release",aiProvider:"claude"};function Y(){try{if(Ms(Lt)){let e=vi(Lt,"utf-8");return{...Fs,...JSON.parse(e)}}}catch{}return{...Fs}}function Ye(e){let s={...Y(),...e};return Ms(Pt)||wi(Pt,{recursive:!0}),bi(Lt,JSON.stringify(s,null,2)),s}var Bs={welcome:"Bienvenido a",subtitle:"tu CLI de confianza para gestionar ramas en GIT",operationCompleted:"Operacion completada!",operationCancelled:"Operacion cancelada. Saliendo...",unknownCommand:"Comando desconocido",errorExecuting:"Error al ejecutar el comando",version:"eazy-git version",whatToDo:"Que deseas hacer?",addChanges:"Agregar cambios a una rama",createOriginal:"Crear rama original",createTemporal:"Crear rama temporal",notGitRepo:"Este directorio no es un repositorio git",gitNotInstalled:"git no esta instalado en el sistema",currentBranch:"Branch actual",filesChanged:"Archivos con cambios",noChangesPending:"No hay cambios pendientes. Deseas continuar de todas formas?",updatingRefs:"Actualizando referencias remotas...",refsUpdated:"Referencias actualizadas",fetchFailed:"No se pudo hacer fetch (continuando...)",baseBranch:"Desde que branch base quieres crear la rama?",baseBranchRequired:"El branch base es requerido",ticketId:"Cual es el identificador del ticket? (ej: DPW-0000)",ticketRequired:"El ticket es requerido",changeType:"Que tipo de cambio es?",branchExistsLocal:e=>`La rama "${e}" ya existe localmente. Que deseas hacer?`,switchToIt:"Cambiarme a ella y continuar",cancel:"Cancelar",cancelledOp:"Operacion cancelada.",creatingBranch:(e,t)=>`Creando rama ${e} desde origin/${t}...`,branchCreated:e=>`Rama ${e} creada`,errorCreatingBranch:e=>`Error al crear la rama: ${e}`,noFilesToStage:"No hay archivos para stagear.",selectFiles:"Cuales archivos quieres incluir en el commit?",stagedFiles:"Archivos en stage",stagedCorrect:"Los archivos en stage son correctos?",aiProvider:"Con que IA quieres generar la sugerencia de commit?",generatingCommit:e=>`Generando sugerencia de commit con ${e}...`,aiSuggestionFailed:e=>`No se pudo obtener sugerencia de ${e}. Escribe el mensaje manualmente.`,writeCommitMsg:"Escribe el mensaje de commit:",commitMsgRequired:"El mensaje es requerido",suggestionOf:e=>`Sugerencia de ${e}`,useThisCommit:"Este mensaje de commit te parece bien?",yesUseIt:"Si, usar este",modify:"Modificar",commitSuccess:"Commit realizado correctamente",hookBlocked:"El pre-commit hook bloqueo el commit. Que deseas hacer?",retryHook:"Ya lo corregi, agrega los cambios y vuelve a intentarlo",skipHook:"Saltar el hook (--no-verify)",commitNoHooks:"Commit realizado (sin hooks)",pushToRemote:"Deseas subir la rama al repositorio remoto?",pushSuccess:"Push realizado",pushForceQuestion:"La rama ya existe en el remoto con historial diferente. Deseas forzar el push? (git push -f)",pushForceSuccess:"Push forzado realizado",pushForceError:e=>`Error en el push forzado: ${e}`,pushError:e=>`Error en el push: ${e}`,summaryTitle:"Resumen",summaryBranch:"Rama",summaryFrom:"Desde",summaryCommit:"Commit",summaryFiles:e=>`${e} archivos commiteados`,summaryPush:"Push",summaryPR:"Crear PR",statusModified:"modificado",statusAdded:"agregado",statusDeleted:"eliminado",statusRenamed:"renombrado",statusUntracked:"sin rastrear",commitTypes:{fix:"fix \u2014 correccion de bug",feat:"feat \u2014 nueva funcionalidad",refactor:"refactor \u2014 mejora sin cambio funcional",chore:"chore \u2014 mantenimiento, dependencias",docs:"docs \u2014 documentacion",test:"test \u2014 pruebas",ci:"ci \u2014 integracion continua",perf:"perf \u2014 rendimiento",style:"style \u2014 formato, sin cambio de logica"},selectBranchType:"Selecciona el tipo de rama:",branchFix:"Fix",branchImprovement:"Mejora",branchFeature:"Feature",branchRefactor:"Refactor",creatingOriginalBranch:"Creando rama original...",branchCreatedAndPushed:e=>`Rama "${e}" creada y pusheada correctamente!`,branchCreatedSuccess:e=>`Rama "${e}" creada correctamente!`,mergeBranchQuestion:"A que rama deseas hacer merge?",developDEV:"develop (DEV)",releaseUAT:"release (UAT)",temporalBranchCreated:"Rama temporal creada correctamente",temporalBranchMerged:"Rama temporal mergeada correctamente",conflictsDetected:"Conflictos detectados. Resolvelos manualmente!",branchPushedToRemote:"Rama pusheada al repositorio remoto",removeTemporalBranch:"Deseas eliminar la rama temporal?",temporalBranchDeleted:"Rama temporal eliminada correctamente",errorCreatingTemporal:"Error creando la rama temporal",enterJiraCode:"Ingresa el codigo del ticket JIRA:",jiraRequired:"El codigo JIRA es requerido!",jiraInvalidFormat:"El codigo JIRA debe tener el formato DPW-0000",fetchingRemote:"Obteniendo cambios remotos...",pullingChanges:"Aplicando cambios en tu rama...",pullError:e=>`Error: ${e}`,pushingChanges:"Subiendo cambios al remoto...",pushedSuccess:"Cambios subidos correctamente!",pushedForceSuccess:"Cambios subidos (forzado) correctamente!",pushQuickError:e=>`Error: ${e}`,provideCommitMsg:"Proporciona un mensaje de commit",stagingChanges:"Stageando cambios...",creatingCommit:"Creando commit...",commitCreated:"Commit creado correctamente!",commitError:e=>`Error: ${e}`,switchingPrevBranch:"Cambiando a la rama anterior...",switchedTo:e=>`Cambiado a rama ${e} correctamente!`,checkoutError:e=>`Error: ${e}`,fetchingLatest:"Obteniendo ultimos cambios...",mergingWith:e=>`Mergeando con ${e}...`,pushingMerged:"Subiendo cambios mergeados...",mergeCompleted:"Merge completado correctamente!",mergeError:e=>`Error: ${e}`,removingLastCommit:"Eliminando ultimo commit...",removeLastConfirm:"Esto eliminara el ultimo commit (los cambios se mantienen en staging). Continuar?",lastCommitRemoved:"Ultimo commit eliminado correctamente!",removeLastError:e=>`Error: ${e}`,logError:e=>`Error: ${e}`,settingUpConfig:"Configurando tu entorno",configSaved:"Configuracion guardada",missingConfigValues:"Faltan valores de configuracion requeridos.",errorWritingConfig:"Error escribiendo archivo de configuracion:",currentConfig:"Configuracion actual",useThisConfig:"Deseas usar esta configuracion?",installingDeps:"Instalando dependencias...",depsInstalled:"Todas las dependencias fueron instaladas",authFailed:"Autenticacion fallida",unexpectedError:"Ocurrio un error inesperado",enterEndpoint:"Ingresa la URL del endpoint:",urlRequired:"La URL es requerida!",urlMustBeHttp:"La URL debe usar protocolo HTTP/HTTPS",urlMustHaveHost:"La URL debe incluir un hostname",urlInvalid:"Ingresa una URL valida",enterApiKey:"Ingresa tu apikey:",apiKeyRequired:"El API key es requerido!",enterRegistryName:"Ingresa el nombre del registro NPM (sin caracteres especiales):",registryNameRequired:"El nombre del registro es requerido!",registryNameLettersOnly:"El nombre del registro debe contener solo letras",enterRegistryURL:"Ingresa la URL del registro NPM (sin http/https):",registryURLRequired:"La URL del registro es requerida!",registryURLStartWithName:"La URL debe empezar con un nombre, evita caracteres especiales",registryURLNoProtocol:"La URL no debe incluir protocolo 'http/https' y debe empezar con una letra",registryURLNoSlash:"La URL no debe empezar con '/' y debe empezar con una letra o numero",registryURLNoWWW:"La URL no debe empezar con 'www' y debe empezar con una letra o numero",languageSelect:"Selecciona el idioma de la interfaz:",languageChanged:e=>`Idioma cambiado a: ${e}`,configMenu:"Que deseas configurar?",configLanguage:"Idioma de la interfaz",configDefaultBranch:"Rama base por defecto",configAIProvider:"Proveedor de IA por defecto",configView:"Ver configuracion actual",defaultBranchSet:e=>`Rama base por defecto: ${e}`,aiProviderSet:e=>`Proveedor de IA por defecto: ${e}`};var ks={welcome:"Welcome to",subtitle:"your trusted CLI for GIT branch management",operationCompleted:"Operation completed!",operationCancelled:"Operation cancelled. Exiting...",unknownCommand:"Unknown command",errorExecuting:"Error executing command",version:"eazy-git version",whatToDo:"What would you like to do?",addChanges:"Add Changes to Branch",createOriginal:"Create Original Branch",createTemporal:"Create Temporal Branch",notGitRepo:"This directory is not a git repository",gitNotInstalled:"git is not installed on the system",currentBranch:"Current branch",filesChanged:"Files with changes",noChangesPending:"No pending changes. Do you want to continue anyway?",updatingRefs:"Updating remote references...",refsUpdated:"References updated",fetchFailed:"Could not fetch (continuing...)",baseBranch:"From which base branch do you want to create the branch?",baseBranchRequired:"Base branch is required",ticketId:"What is the ticket identifier? (e.g.: DPW-0000)",ticketRequired:"Ticket is required",changeType:"What type of change is this?",branchExistsLocal:e=>`Branch "${e}" already exists locally. What would you like to do?`,switchToIt:"Switch to it and continue",cancel:"Cancel",cancelledOp:"Operation cancelled.",creatingBranch:(e,t)=>`Creating branch ${e} from origin/${t}...`,branchCreated:e=>`Branch ${e} created`,errorCreatingBranch:e=>`Error creating branch: ${e}`,noFilesToStage:"No files to stage.",selectFiles:"Which files do you want to include in the commit?",stagedFiles:"Staged files",stagedCorrect:"Are the staged files correct?",aiProvider:"Which AI do you want to use for the commit suggestion?",generatingCommit:e=>`Generating commit suggestion with ${e}...`,aiSuggestionFailed:e=>`Could not get suggestion from ${e}. Write the message manually.`,writeCommitMsg:"Write the commit message:",commitMsgRequired:"Message is required",suggestionOf:e=>`${e} suggestion`,useThisCommit:"Does this commit message look good?",yesUseIt:"Yes, use it",modify:"Modify",commitSuccess:"Commit created successfully",hookBlocked:"The pre-commit hook blocked the commit. What would you like to do?",retryHook:"I fixed it, re-stage and retry",skipHook:"Skip the hook (--no-verify)",commitNoHooks:"Commit created (without hooks)",pushToRemote:"Do you want to push the branch to the remote repository?",pushSuccess:"Push completed",pushForceQuestion:"The branch already exists on remote with different history. Force push? (git push -f)",pushForceSuccess:"Force push completed",pushForceError:e=>`Error in force push: ${e}`,pushError:e=>`Error in push: ${e}`,summaryTitle:"Summary",summaryBranch:"Branch",summaryFrom:"From",summaryCommit:"Commit",summaryFiles:e=>`${e} files committed`,summaryPush:"Push",summaryPR:"Create PR",statusModified:"modified",statusAdded:"added",statusDeleted:"deleted",statusRenamed:"renamed",statusUntracked:"untracked",commitTypes:{fix:"fix - bug fix",feat:"feat - new feature",refactor:"refactor - improvement without functional change",chore:"chore - maintenance, dependencies",docs:"docs - documentation",test:"test - testing",ci:"ci - continuous integration",perf:"perf - performance",style:"style - formatting, no logic change"},selectBranchType:"Select the branch type:",branchFix:"Fix",branchImprovement:"Improvement",branchFeature:"Feature",branchRefactor:"Refactor",creatingOriginalBranch:"Creating original branch...",branchCreatedAndPushed:e=>`Branch "${e}" created and pushed successfully!`,branchCreatedSuccess:e=>`Branch "${e}" created successfully!`,mergeBranchQuestion:"Which branch do you want to merge into?",developDEV:"develop (DEV)",releaseUAT:"release (UAT)",temporalBranchCreated:"Temporal branch created successfully",temporalBranchMerged:"Temporal branch merged successfully",conflictsDetected:"Conflicts detected. Please resolve them manually!",branchPushedToRemote:"Branch pushed to remote repository",removeTemporalBranch:"Do you want to remove the temporal branch?",temporalBranchDeleted:"Temporal branch deleted successfully",errorCreatingTemporal:"Error creating the temporal branch",enterJiraCode:"Enter the JIRA ticket code:",jiraRequired:"JIRA code is required!",jiraInvalidFormat:"JIRA code must have the format DPW-0000",fetchingRemote:"Fetching remote changes...",pullingChanges:"Pulling changes into your branch...",pullError:e=>`Error: ${e}`,pushingChanges:"Pushing changes to remote...",pushedSuccess:"Changes pushed successfully!",pushedForceSuccess:"Changes pushed (force) successfully!",pushQuickError:e=>`Error: ${e}`,provideCommitMsg:"Please provide a commit message",stagingChanges:"Staging changes...",creatingCommit:"Creating commit...",commitCreated:"Commit created successfully!",commitError:e=>`Error: ${e}`,switchingPrevBranch:"Switching to previous branch...",switchedTo:e=>`Successfully switched to ${e} branch!`,checkoutError:e=>`Error: ${e}`,fetchingLatest:"Fetching latest changes...",mergingWith:e=>`Merging with ${e}...`,pushingMerged:"Pushing merged changes...",mergeCompleted:"Merge completed successfully!",mergeError:e=>`Error: ${e}`,removingLastCommit:"Removing last commit...",removeLastConfirm:"This will remove the last commit (changes will remain in staging). Continue?",lastCommitRemoved:"Last commit removed successfully!",removeLastError:e=>`Error: ${e}`,logError:e=>`Error: ${e}`,settingUpConfig:"Setting up your configuration",configSaved:"Configuration saved",missingConfigValues:"Missing required configuration values.",errorWritingConfig:"Error writing configuration file:",currentConfig:"Current configuration",useThisConfig:"Would you like to use this configuration?",installingDeps:"Installing dependencies...",depsInstalled:"All dependencies were installed",authFailed:"Authentication failed",unexpectedError:"An unexpected error occurred",enterEndpoint:"Enter your endpoint URL:",urlRequired:"URL is required!",urlMustBeHttp:"URL must use HTTP/HTTPS protocol",urlMustHaveHost:"URL must include a hostname",urlInvalid:"Please enter a valid URL",enterApiKey:"Enter your apikey:",apiKeyRequired:"API key is required!",enterRegistryName:"Enter your NPM registry name (without special characters):",registryNameRequired:"Registry name is required!",registryNameLettersOnly:"Registry name must contain only letters",enterRegistryURL:"Enter your NPM registry URL (without http/https):",registryURLRequired:"Registry URL is required!",registryURLStartWithName:"URL must start with a name only, avoid special characters",registryURLNoProtocol:"URL must not include 'http/https' protocol and must start with a letter",registryURLNoSlash:"URL must not start with '/' and must begin with a letter or number",registryURLNoWWW:"URL must not start with 'www' and must begin with a letter or number",languageSelect:"Select the interface language:",languageChanged:e=>`Language changed to: ${e}`,configMenu:"What would you like to configure?",configLanguage:"Interface language",configDefaultBranch:"Default base branch",configAIProvider:"Default AI provider",configView:"View current configuration",defaultBranchSet:e=>`Default base branch: ${e}`,aiProviderSet:e=>`Default AI provider: ${e}`};var Qe={es:Bs,en:ks};function h(e,...t){let r=Y().language||"es",o=(Qe[r]||Qe.es)[e];return typeof o=="function"?o(...t):o||e}function Ps(){let t=Y().language||"es";return(Qe[t]||Qe.es).commitTypes}function Ls(){return[{value:"es",label:"Espanol"},{value:"en",label:"English"}]}function F(e){if(Ce(e))return Fe(h("operationCancelled")),process.exit(0)}var Ns=(e=0)=>t=>`\x1B[${t+e}m`,Ds=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Vs=(e=0)=>(t,s,r)=>`\x1B[${38+e};2;${t};${s};${r}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Wn=Object.keys(L.modifier),Ii=Object.keys(L.color),Si=Object.keys(L.bgColor),qn=[...Ii,...Si];function Ei(){let e=new Map;for(let[t,s]of Object.entries(L)){for(let[r,i]of Object.entries(s))L[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},s[r]=L[r],e.set(i[0],i[1]);Object.defineProperty(L,t,{value:s,enumerable:!1})}return Object.defineProperty(L,"codes",{value:e,enumerable:!1}),L.color.close="\x1B[39m",L.bgColor.close="\x1B[49m",L.color.ansi=Ns(),L.color.ansi256=Ds(),L.color.ansi16m=Vs(),L.bgColor.ansi=Ns(10),L.bgColor.ansi256=Ds(10),L.bgColor.ansi16m=Vs(10),Object.defineProperties(L,{rgbToAnsi256:{value(t,s,r){return t===s&&s===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[r]=s;r.length===3&&(r=[...r].map(o=>o+o).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>L.rgbToAnsi256(...L.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,r,i;if(t>=232)s=((t-232)*10+8)/255,r=s,i=s;else{t-=16;let u=t%36;s=Math.floor(t/36)/5,r=Math.floor(u/6)/5,i=u%6/5}let o=Math.max(s,r,i)*2;if(o===0)return 30;let a=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(s));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,s,r)=>L.ansi256ToAnsi(L.rgbToAnsi256(t,s,r)),enumerable:!1},hexToAnsi:{value:t=>L.ansi256ToAnsi(L.hexToAnsi256(t)),enumerable:!1}}),L}var xi=Ei(),re=xi;import Nt from"node:process";import Ti from"node:os";import Us from"node:tty";function Z(e,t=globalThis.Deno?globalThis.Deno.args:Nt.argv){let s=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(s+e),i=t.indexOf("--");return r!==-1&&(i===-1||r<i)}var{env:U}=Nt,Xe;Z("no-color")||Z("no-colors")||Z("color=false")||Z("color=never")?Xe=0:(Z("color")||Z("colors")||Z("color=true")||Z("color=always"))&&(Xe=1);function Ri(){if("FORCE_COLOR"in U)return U.FORCE_COLOR==="true"?1:U.FORCE_COLOR==="false"?0:U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}function _i(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Ai(e,{streamIsTTY:t,sniffFlags:s=!0}={}){let r=Ri();r!==void 0&&(Xe=r);let i=s?Xe:r;if(i===0)return 0;if(s){if(Z("color=16m")||Z("color=full")||Z("color=truecolor"))return 3;if(Z("color=256"))return 2}if("TF_BUILD"in U&&"AGENT_NAME"in U)return 1;if(e&&!t&&i===void 0)return 0;let o=i||0;if(U.TERM==="dumb")return o;if(Nt.platform==="win32"){let a=Ti.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in U)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in U)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in U)||U.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor"||U.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in U){let a=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(U.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM)||"COLORTERM"in U?1:o}function Gs(e,t={}){let s=Ai(e,{streamIsTTY:e&&e.isTTY,...t});return _i(s)}var Fi={stdout:Gs({isTTY:Us.isatty(1)}),stderr:Gs({isTTY:Us.isatty(2)})},js=Fi;function Ws(e,t,s){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,o=0,a="";do a+=e.slice(o,r)+t+s,o=r+i,r=e.indexOf(t,o);while(r!==-1);return a+=e.slice(o),a}function qs(e,t,s,r){let i=0,o="";do{let a=e[r-1]==="\r";o+=e.slice(i,a?r-1:r)+t+(a?`\r
|
|
161
|
+
`}case"submit":{let a=o?` ${n("dim",o)}`:"",l=t?n("gray",f):"";return`${s}${l}${a}`}case"cancel":{let a=o?` ${n(["strikethrough","dim"],o)}`:"",l=t?n("gray",f):"";return`${s}${l}${a}${o.trim()?`
|
|
162
|
+
${l}`:""}`}default:{let a=t?`${n("cyan",f)} `:"",l=t?n("cyan",V):"";return`${s}${a}${i}
|
|
163
|
+
${l}
|
|
164
|
+
`}}}}).prompt()});Z();Z();import{spawnSync as tr}from"child_process";Z();Z();import{existsSync as Bs,readFileSync as bi,writeFileSync as wi,mkdirSync as Ci}from"fs";import Ii from"os";import ks from"path";var Nt=ks.join(Ii.homedir(),".eazy-git"),Dt=ks.join(Nt,"config.json"),Os={language:"es",defaultBaseBranch:"release",aiProvider:"claude"};function Y(){try{if(Bs(Dt)){let e=bi(Dt,"utf-8");return{...Os,...JSON.parse(e)}}}catch{}return{...Os}}function Qe(e){let s={...Y(),...e};return Bs(Nt)||Ci(Nt,{recursive:!0}),wi(Dt,JSON.stringify(s,null,2)),s}var Ls={welcome:"Bienvenido a",subtitle:"tu CLI de confianza para gestionar ramas en GIT",operationCompleted:"Operacion completada!",operationCancelled:"Operacion cancelada. Saliendo...",unknownCommand:"Comando desconocido",errorExecuting:"Error al ejecutar el comando",version:"eazy-git version",whatToDo:"Que deseas hacer?",addChanges:"Agregar cambios a una rama",createOriginal:"Crear rama original",createTemporal:"Crear rama temporal",notGitRepo:"Este directorio no es un repositorio git",gitNotInstalled:"git no esta instalado en el sistema",currentBranch:"Branch actual",filesChanged:"Archivos con cambios",noChangesPending:"No hay cambios pendientes. Deseas continuar de todas formas?",updatingRefs:"Actualizando referencias remotas...",refsUpdated:"Referencias actualizadas",fetchFailed:"No se pudo hacer fetch (continuando...)",baseBranch:"Desde que branch base quieres crear la rama?",baseBranchRequired:"El branch base es requerido",ticketId:"Cual es el identificador del ticket? (ej: DPW-0000)",ticketRequired:"El ticket es requerido",changeType:"Que tipo de cambio es?",branchExistsLocal:e=>`La rama "${e}" ya existe localmente. Que deseas hacer?`,switchToIt:"Cambiarme a ella y continuar",cancel:"Cancelar",cancelledOp:"Operacion cancelada.",creatingBranch:(e,t)=>`Creando rama ${e} desde origin/${t}...`,branchCreated:e=>`Rama ${e} creada`,errorCreatingBranch:e=>`Error al crear la rama: ${e}`,noFilesToStage:"No hay archivos para stagear.",selectFiles:"Cuales archivos quieres incluir en el commit?",selectAllFiles:"Seleccionar todos los archivos",stagedFiles:"Archivos en stage",stagedCorrect:"Los archivos en stage son correctos?",aiProvider:"Con que IA quieres generar la sugerencia de commit?",generatingCommit:e=>`Generando sugerencia de commit con ${e}...`,aiSuggestionFailed:e=>`No se pudo obtener sugerencia de ${e}. Escribe el mensaje manualmente.`,writeCommitMsg:"Escribe el mensaje de commit:",commitMsgRequired:"El mensaje es requerido",suggestionOf:e=>`Sugerencia de ${e}`,useThisCommit:"Este mensaje de commit te parece bien?",yesUseIt:"Si, usar este",modify:"Modificar",commitSuccess:"Commit realizado correctamente",hookBlocked:"El pre-commit hook bloqueo el commit. Que deseas hacer?",retryHook:"Ya lo corregi, agrega los cambios y vuelve a intentarlo",skipHook:"Saltar el hook (--no-verify)",commitNoHooks:"Commit realizado (sin hooks)",pushToRemote:"Deseas subir la rama al repositorio remoto?",pushSuccess:"Push realizado",pushForceQuestion:"La rama ya existe en el remoto con historial diferente. Deseas forzar el push? (git push -f)",pushForceSuccess:"Push forzado realizado",pushForceError:e=>`Error en el push forzado: ${e}`,pushError:e=>`Error en el push: ${e}`,summaryTitle:"Resumen",summaryBranch:"Rama",summaryFrom:"Desde",summaryCommit:"Commit",summaryFiles:e=>`${e} archivos commiteados`,summaryPush:"Push",summaryPR:"Crear PR",statusModified:"modificado",statusAdded:"agregado",statusDeleted:"eliminado",statusRenamed:"renombrado",statusUntracked:"sin rastrear",commitTypes:{fix:"fix \u2014 correccion de bug",feat:"feat \u2014 nueva funcionalidad",refactor:"refactor \u2014 mejora sin cambio funcional",chore:"chore \u2014 mantenimiento, dependencias",docs:"docs \u2014 documentacion",test:"test \u2014 pruebas",ci:"ci \u2014 integracion continua",perf:"perf \u2014 rendimiento",style:"style \u2014 formato, sin cambio de logica"},selectBranchType:"Selecciona el tipo de rama:",branchFix:"Fix",branchImprovement:"Mejora",branchFeature:"Feature",branchRefactor:"Refactor",creatingOriginalBranch:"Creando rama original...",branchCreatedAndPushed:e=>`Rama "${e}" creada y pusheada correctamente!`,branchCreatedSuccess:e=>`Rama "${e}" creada correctamente!`,mergeBranchQuestion:"A que rama deseas hacer merge?",developDEV:"develop (DEV)",releaseUAT:"release (UAT)",temporalBranchCreated:"Rama temporal creada correctamente",temporalBranchMerged:"Rama temporal mergeada correctamente",conflictsDetected:"Conflictos detectados. Resolvelos manualmente!",branchPushedToRemote:"Rama pusheada al repositorio remoto",removeTemporalBranch:"Deseas eliminar la rama temporal?",temporalBranchDeleted:"Rama temporal eliminada correctamente",errorCreatingTemporal:"Error creando la rama temporal",enterJiraCode:"Ingresa el codigo del ticket JIRA:",jiraRequired:"El codigo JIRA es requerido!",jiraInvalidFormat:"El codigo JIRA debe tener el formato DPW-0000",fetchingRemote:"Obteniendo cambios remotos...",pullingChanges:"Aplicando cambios en tu rama...",pullError:e=>`Error: ${e}`,pushingChanges:"Subiendo cambios al remoto...",pushedSuccess:"Cambios subidos correctamente!",pushedForceSuccess:"Cambios subidos (forzado) correctamente!",pushQuickError:e=>`Error: ${e}`,provideCommitMsg:"Proporciona un mensaje de commit",stagingChanges:"Stageando cambios...",creatingCommit:"Creando commit...",commitCreated:"Commit creado correctamente!",commitError:e=>`Error: ${e}`,switchingPrevBranch:"Cambiando a la rama anterior...",switchedTo:e=>`Cambiado a rama ${e} correctamente!`,checkoutError:e=>`Error: ${e}`,fetchingLatest:"Obteniendo ultimos cambios...",mergingWith:e=>`Mergeando con ${e}...`,pushingMerged:"Subiendo cambios mergeados...",mergeCompleted:"Merge completado correctamente!",mergeError:e=>`Error: ${e}`,removingLastCommit:"Eliminando ultimo commit...",removeLastConfirm:"Esto eliminara el ultimo commit (los cambios se mantienen en staging). Continuar?",lastCommitRemoved:"Ultimo commit eliminado correctamente!",removeLastError:e=>`Error: ${e}`,logError:e=>`Error: ${e}`,settingUpConfig:"Configurando tu entorno",configSaved:"Configuracion guardada",missingConfigValues:"Faltan valores de configuracion requeridos.",errorWritingConfig:"Error escribiendo archivo de configuracion:",currentConfig:"Configuracion actual",useThisConfig:"Deseas usar esta configuracion?",installingDeps:"Instalando dependencias...",depsInstalled:"Todas las dependencias fueron instaladas",authFailed:"Autenticacion fallida",unexpectedError:"Ocurrio un error inesperado",enterEndpoint:"Ingresa la URL del endpoint:",urlRequired:"La URL es requerida!",urlMustBeHttp:"La URL debe usar protocolo HTTP/HTTPS",urlMustHaveHost:"La URL debe incluir un hostname",urlInvalid:"Ingresa una URL valida",enterApiKey:"Ingresa tu apikey:",apiKeyRequired:"El API key es requerido!",enterRegistryName:"Ingresa el nombre del registro NPM (sin caracteres especiales):",registryNameRequired:"El nombre del registro es requerido!",registryNameLettersOnly:"El nombre del registro debe contener solo letras",enterRegistryURL:"Ingresa la URL del registro NPM (sin http/https):",registryURLRequired:"La URL del registro es requerida!",registryURLStartWithName:"La URL debe empezar con un nombre, evita caracteres especiales",registryURLNoProtocol:"La URL no debe incluir protocolo 'http/https' y debe empezar con una letra",registryURLNoSlash:"La URL no debe empezar con '/' y debe empezar con una letra o numero",registryURLNoWWW:"La URL no debe empezar con 'www' y debe empezar con una letra o numero",languageSelect:"Selecciona el idioma de la interfaz:",languageChanged:e=>`Idioma cambiado a: ${e}`,configMenu:"Que deseas configurar?",configLanguage:"Idioma de la interfaz",configDefaultBranch:"Rama base por defecto",configAIProvider:"Proveedor de IA por defecto",configView:"Ver configuracion actual",defaultBranchSet:e=>`Rama base por defecto: ${e}`,aiProviderSet:e=>`Proveedor de IA por defecto: ${e}`};var Ps={welcome:"Welcome to",subtitle:"your trusted CLI for GIT branch management",operationCompleted:"Operation completed!",operationCancelled:"Operation cancelled. Exiting...",unknownCommand:"Unknown command",errorExecuting:"Error executing command",version:"eazy-git version",whatToDo:"What would you like to do?",addChanges:"Add Changes to Branch",createOriginal:"Create Original Branch",createTemporal:"Create Temporal Branch",notGitRepo:"This directory is not a git repository",gitNotInstalled:"git is not installed on the system",currentBranch:"Current branch",filesChanged:"Files with changes",noChangesPending:"No pending changes. Do you want to continue anyway?",updatingRefs:"Updating remote references...",refsUpdated:"References updated",fetchFailed:"Could not fetch (continuing...)",baseBranch:"From which base branch do you want to create the branch?",baseBranchRequired:"Base branch is required",ticketId:"What is the ticket identifier? (e.g.: DPW-0000)",ticketRequired:"Ticket is required",changeType:"What type of change is this?",branchExistsLocal:e=>`Branch "${e}" already exists locally. What would you like to do?`,switchToIt:"Switch to it and continue",cancel:"Cancel",cancelledOp:"Operation cancelled.",creatingBranch:(e,t)=>`Creating branch ${e} from origin/${t}...`,branchCreated:e=>`Branch ${e} created`,errorCreatingBranch:e=>`Error creating branch: ${e}`,noFilesToStage:"No files to stage.",selectFiles:"Which files do you want to include in the commit?",selectAllFiles:"Select all files",stagedFiles:"Staged files",stagedCorrect:"Are the staged files correct?",aiProvider:"Which AI do you want to use for the commit suggestion?",generatingCommit:e=>`Generating commit suggestion with ${e}...`,aiSuggestionFailed:e=>`Could not get suggestion from ${e}. Write the message manually.`,writeCommitMsg:"Write the commit message:",commitMsgRequired:"Message is required",suggestionOf:e=>`${e} suggestion`,useThisCommit:"Does this commit message look good?",yesUseIt:"Yes, use it",modify:"Modify",commitSuccess:"Commit created successfully",hookBlocked:"The pre-commit hook blocked the commit. What would you like to do?",retryHook:"I fixed it, re-stage and retry",skipHook:"Skip the hook (--no-verify)",commitNoHooks:"Commit created (without hooks)",pushToRemote:"Do you want to push the branch to the remote repository?",pushSuccess:"Push completed",pushForceQuestion:"The branch already exists on remote with different history. Force push? (git push -f)",pushForceSuccess:"Force push completed",pushForceError:e=>`Error in force push: ${e}`,pushError:e=>`Error in push: ${e}`,summaryTitle:"Summary",summaryBranch:"Branch",summaryFrom:"From",summaryCommit:"Commit",summaryFiles:e=>`${e} files committed`,summaryPush:"Push",summaryPR:"Create PR",statusModified:"modified",statusAdded:"added",statusDeleted:"deleted",statusRenamed:"renamed",statusUntracked:"untracked",commitTypes:{fix:"fix - bug fix",feat:"feat - new feature",refactor:"refactor - improvement without functional change",chore:"chore - maintenance, dependencies",docs:"docs - documentation",test:"test - testing",ci:"ci - continuous integration",perf:"perf - performance",style:"style - formatting, no logic change"},selectBranchType:"Select the branch type:",branchFix:"Fix",branchImprovement:"Improvement",branchFeature:"Feature",branchRefactor:"Refactor",creatingOriginalBranch:"Creating original branch...",branchCreatedAndPushed:e=>`Branch "${e}" created and pushed successfully!`,branchCreatedSuccess:e=>`Branch "${e}" created successfully!`,mergeBranchQuestion:"Which branch do you want to merge into?",developDEV:"develop (DEV)",releaseUAT:"release (UAT)",temporalBranchCreated:"Temporal branch created successfully",temporalBranchMerged:"Temporal branch merged successfully",conflictsDetected:"Conflicts detected. Please resolve them manually!",branchPushedToRemote:"Branch pushed to remote repository",removeTemporalBranch:"Do you want to remove the temporal branch?",temporalBranchDeleted:"Temporal branch deleted successfully",errorCreatingTemporal:"Error creating the temporal branch",enterJiraCode:"Enter the JIRA ticket code:",jiraRequired:"JIRA code is required!",jiraInvalidFormat:"JIRA code must have the format DPW-0000",fetchingRemote:"Fetching remote changes...",pullingChanges:"Pulling changes into your branch...",pullError:e=>`Error: ${e}`,pushingChanges:"Pushing changes to remote...",pushedSuccess:"Changes pushed successfully!",pushedForceSuccess:"Changes pushed (force) successfully!",pushQuickError:e=>`Error: ${e}`,provideCommitMsg:"Please provide a commit message",stagingChanges:"Staging changes...",creatingCommit:"Creating commit...",commitCreated:"Commit created successfully!",commitError:e=>`Error: ${e}`,switchingPrevBranch:"Switching to previous branch...",switchedTo:e=>`Successfully switched to ${e} branch!`,checkoutError:e=>`Error: ${e}`,fetchingLatest:"Fetching latest changes...",mergingWith:e=>`Merging with ${e}...`,pushingMerged:"Pushing merged changes...",mergeCompleted:"Merge completed successfully!",mergeError:e=>`Error: ${e}`,removingLastCommit:"Removing last commit...",removeLastConfirm:"This will remove the last commit (changes will remain in staging). Continue?",lastCommitRemoved:"Last commit removed successfully!",removeLastError:e=>`Error: ${e}`,logError:e=>`Error: ${e}`,settingUpConfig:"Setting up your configuration",configSaved:"Configuration saved",missingConfigValues:"Missing required configuration values.",errorWritingConfig:"Error writing configuration file:",currentConfig:"Current configuration",useThisConfig:"Would you like to use this configuration?",installingDeps:"Installing dependencies...",depsInstalled:"All dependencies were installed",authFailed:"Authentication failed",unexpectedError:"An unexpected error occurred",enterEndpoint:"Enter your endpoint URL:",urlRequired:"URL is required!",urlMustBeHttp:"URL must use HTTP/HTTPS protocol",urlMustHaveHost:"URL must include a hostname",urlInvalid:"Please enter a valid URL",enterApiKey:"Enter your apikey:",apiKeyRequired:"API key is required!",enterRegistryName:"Enter your NPM registry name (without special characters):",registryNameRequired:"Registry name is required!",registryNameLettersOnly:"Registry name must contain only letters",enterRegistryURL:"Enter your NPM registry URL (without http/https):",registryURLRequired:"Registry URL is required!",registryURLStartWithName:"URL must start with a name only, avoid special characters",registryURLNoProtocol:"URL must not include 'http/https' protocol and must start with a letter",registryURLNoSlash:"URL must not start with '/' and must begin with a letter or number",registryURLNoWWW:"URL must not start with 'www' and must begin with a letter or number",languageSelect:"Select the interface language:",languageChanged:e=>`Language changed to: ${e}`,configMenu:"What would you like to configure?",configLanguage:"Interface language",configDefaultBranch:"Default base branch",configAIProvider:"Default AI provider",configView:"View current configuration",defaultBranchSet:e=>`Default base branch: ${e}`,aiProviderSet:e=>`Default AI provider: ${e}`};var Xe={es:Ls,en:Ps};function h(e,...t){let r=Y().language||"es",o=(Xe[r]||Xe.es)[e];return typeof o=="function"?o(...t):o||e}function Ns(){let t=Y().language||"es";return(Xe[t]||Xe.es).commitTypes}function Ds(){return[{value:"es",label:"Espanol"},{value:"en",label:"English"}]}function A(e){if(Ie(e))return Me(h("operationCancelled")),process.exit(0)}var Vs=(e=0)=>t=>`\x1B[${t+e}m`,Us=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Gs=(e=0)=>(t,s,r)=>`\x1B[${38+e};2;${t};${s};${r}m`,P={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},qn=Object.keys(P.modifier),Si=Object.keys(P.color),Ei=Object.keys(P.bgColor),Hn=[...Si,...Ei];function xi(){let e=new Map;for(let[t,s]of Object.entries(P)){for(let[r,i]of Object.entries(s))P[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},s[r]=P[r],e.set(i[0],i[1]);Object.defineProperty(P,t,{value:s,enumerable:!1})}return Object.defineProperty(P,"codes",{value:e,enumerable:!1}),P.color.close="\x1B[39m",P.bgColor.close="\x1B[49m",P.color.ansi=Vs(),P.color.ansi256=Us(),P.color.ansi16m=Gs(),P.bgColor.ansi=Vs(10),P.bgColor.ansi256=Us(10),P.bgColor.ansi16m=Gs(10),Object.defineProperties(P,{rgbToAnsi256:{value(t,s,r){return t===s&&s===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(s/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(t){let s=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!s)return[0,0,0];let[r]=s;r.length===3&&(r=[...r].map(o=>o+o).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>P.rgbToAnsi256(...P.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let s,r,i;if(t>=232)s=((t-232)*10+8)/255,r=s,i=s;else{t-=16;let l=t%36;s=Math.floor(t/36)/5,r=Math.floor(l/6)/5,i=l%6/5}let o=Math.max(s,r,i)*2;if(o===0)return 30;let a=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(s));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,s,r)=>P.ansi256ToAnsi(P.rgbToAnsi256(t,s,r)),enumerable:!1},hexToAnsi:{value:t=>P.ansi256ToAnsi(P.hexToAnsi256(t)),enumerable:!1}}),P}var Ti=xi(),re=Ti;import Vt from"node:process";import Ri from"node:os";import js from"node:tty";function ee(e,t=globalThis.Deno?globalThis.Deno.args:Vt.argv){let s=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(s+e),i=t.indexOf("--");return r!==-1&&(i===-1||r<i)}var{env:U}=Vt,Ze;ee("no-color")||ee("no-colors")||ee("color=false")||ee("color=never")?Ze=0:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(Ze=1);function _i(){if("FORCE_COLOR"in U)return U.FORCE_COLOR==="true"?1:U.FORCE_COLOR==="false"?0:U.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(U.FORCE_COLOR,10),3)}function Ai(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Fi(e,{streamIsTTY:t,sniffFlags:s=!0}={}){let r=_i();r!==void 0&&(Ze=r);let i=s?Ze:r;if(i===0)return 0;if(s){if(ee("color=16m")||ee("color=full")||ee("color=truecolor"))return 3;if(ee("color=256"))return 2}if("TF_BUILD"in U&&"AGENT_NAME"in U)return 1;if(e&&!t&&i===void 0)return 0;let o=i||0;if(U.TERM==="dumb")return o;if(Vt.platform==="win32"){let a=Ri.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in U)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in U)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in U)||U.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in U)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(U.TEAMCITY_VERSION)?1:0;if(U.COLORTERM==="truecolor"||U.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in U){let a=Number.parseInt((U.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(U.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(U.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(U.TERM)||"COLORTERM"in U?1:o}function Ws(e,t={}){let s=Fi(e,{streamIsTTY:e&&e.isTTY,...t});return Ai(s)}var Mi={stdout:Ws({isTTY:js.isatty(1)}),stderr:Ws({isTTY:js.isatty(2)})},qs=Mi;function Hs(e,t,s){let r=e.indexOf(t);if(r===-1)return e;let i=t.length,o=0,a="";do a+=e.slice(o,r)+t+s,o=r+i,r=e.indexOf(t,o);while(r!==-1);return a+=e.slice(o),a}function Ks(e,t,s,r){let i=0,o="";do{let a=e[r-1]==="\r";o+=e.slice(i,a?r-1:r)+t+(a?`\r
|
|
165
165
|
`:`
|
|
166
166
|
`)+s,i=r+1,r=e.indexOf(`
|
|
167
|
-
`,i)}while(r!==-1);return o+=e.slice(i),o}var{stdout:
|
|
168
|
-
`);return o!==-1&&(t=
|
|
169
|
-
`):[]}var
|
|
167
|
+
`,i)}while(r!==-1);return o+=e.slice(i),o}var{stdout:zs,stderr:Js}=qs,Ut=Symbol("GENERATOR"),xe=Symbol("STYLER"),Oe=Symbol("IS_EMPTY"),Ys=["ansi","ansi","ansi256","ansi16m"],Te=Object.create(null),Oi=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let s=zs?zs.level:0;e.level=t.level===void 0?s:t.level};var Bi=e=>{let t=(...s)=>s.join(" ");return Oi(t,e),Object.setPrototypeOf(t,Be.prototype),t};function Be(e){return Bi(e)}Object.setPrototypeOf(Be.prototype,Function.prototype);for(let[e,t]of Object.entries(re))Te[e]={get(){let s=et(this,jt(t.open,t.close,this[xe]),this[Oe]);return Object.defineProperty(this,e,{value:s}),s}};Te.visible={get(){let e=et(this,this[xe],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Gt=(e,t,s,...r)=>e==="rgb"?t==="ansi16m"?re[s].ansi16m(...r):t==="ansi256"?re[s].ansi256(re.rgbToAnsi256(...r)):re[s].ansi(re.rgbToAnsi(...r)):e==="hex"?Gt("rgb",t,s,...re.hexToRgb(...r)):re[s][e](...r),ki=["rgb","hex","ansi256"];for(let e of ki){Te[e]={get(){let{level:s}=this;return function(...r){let i=jt(Gt(e,Ys[s],"color",...r),re.color.close,this[xe]);return et(this,i,this[Oe])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Te[t]={get(){let{level:s}=this;return function(...r){let i=jt(Gt(e,Ys[s],"bgColor",...r),re.bgColor.close,this[xe]);return et(this,i,this[Oe])}}}}var Li=Object.defineProperties(()=>{},{...Te,level:{enumerable:!0,get(){return this[Ut].level},set(e){this[Ut].level=e}}}),jt=(e,t,s)=>{let r,i;return s===void 0?(r=e,i=t):(r=s.openAll+e,i=t+s.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:s}},et=(e,t,s)=>{let r=(...i)=>Pi(r,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(r,Li),r[Ut]=e,r[xe]=t,r[Oe]=s,r},Pi=(e,t)=>{if(e.level<=0||!t)return e[Oe]?"":t;let s=e[xe];if(s===void 0)return t;let{openAll:r,closeAll:i}=s;if(t.includes("\x1B"))for(;s!==void 0;)t=Hs(t,s.close,s.open),s=s.parent;let o=t.indexOf(`
|
|
168
|
+
`);return o!==-1&&(t=Ks(t,i,r,o)),r+t+i};Object.defineProperties(Be.prototype,Te);var Ni=Be(),so=Be({level:Js?Js.level:0});var ye=Ni;var Re={primary:"#57d7c4",secondary:"#199288",muted:"#9ca3af",success:"#06D6A0",error:"#EF4444",warning:"#F59E0B"},F={primary:e=>ye.hex(Re.primary)(e),secondary:e=>ye.hex(Re.secondary)(e),muted:e=>ye.hex(Re.muted)(e),success:e=>ye.hex(Re.success)(e),error:e=>ye.hex(Re.error)(e),warning:e=>ye.hex(Re.warning)(e)};var Di=async()=>{let e=await H({message:F.secondary(h("selectBranchType")),options:[{value:"fix",label:h("branchFix")},{value:"improvement",label:h("branchImprovement")},{value:"feature",label:h("branchFeature")},{value:"refactor",label:h("branchRefactor")}]});return A(e),e},Qs=Di;Z();var Vi=e=>/^[A-Z]{3}-\d{4}$/.test(e),Xs=Vi;var Ui=async()=>{let e=await ue({message:F.secondary(h("enterJiraCode")),placeholder:"DPW-0000",initialValue:"",validate(t){if(!t?.trim())return h("jiraRequired");if(!Xs(t))return h("jiraInvalidFormat")}});return A(e),e},Zs=Ui;var Gi=async()=>{let e=await Qs(),t=await Zs();return`${e}/${t}`},er=Gi;var ji=async()=>{let e=Y(),t=await er(),s=$e();try{s.start(h("creatingOriginalBranch")),tr("git",["checkout","-b",t,`origin/${e.defaultBaseBranch}`],{stdio:"inherit"}),tr("git",["push","origin",t],{stdio:"inherit"}),s.stop(h("branchCreatedAndPushed",t)),E.success(h("branchCreatedSuccess",t))}catch(r){s.stop(""),E.error(h("errorCreatingBranch",r.message))}},sr=ji;Z();import{spawnSync as _e}from"child_process";Z();var Wi=async()=>{let e=await H({message:F.secondary(h("mergeBranchQuestion")),options:[{value:"develop",label:h("developDEV")},{value:"release",label:h("releaseUAT")}],required:!0,initialValue:"develop"});return A(e),e},rr=Wi;import{execSync as qi}from"child_process";var Hi=()=>qi("git rev-parse --abbrev-ref HEAD").toString().trim(),ir=Hi;var Ki=async()=>{try{let e=await rr(),t=ir(),s=`${t}-${e}`;if(_e("git",["checkout","-b",s,`origin/${e}`],{stdio:"inherit"}),E.success(h("temporalBranchCreated")),_e("git",["merge",`origin/${t}`],{stdio:"inherit"}),E.success(h("temporalBranchMerged")),_e("git",["status","--porcelain"],{encoding:"utf-8"}).stdout.includes("UU")){E.warn(h("conflictsDetected"));return}_e("git",["push","origin",s],{stdio:"inherit"}),E.info(h("branchPushedToRemote"));let i=await le({message:h("removeTemporalBranch")});A(i),i&&(_e("git",["checkout",t],{stdio:"inherit"}),_e("git",["branch","-D",s],{stdio:"inherit"}),E.info(h("temporalBranchDeleted")))}catch(e){E.error(`${h("errorCreatingTemporal")}: ${e.message}`)}},nr=Ki;Z();import{execSync as ve,spawnSync as te,spawn as zi}from"child_process";function or(e){let t=e.slice(3).trim();return t.includes(" -> ")?t.split(" -> ")[1].trim():t}function ar(){let e=ve("git status --short",{encoding:"utf-8"}).trim();return e?e.split(`
|
|
169
|
+
`):[]}var Ji=async()=>{let e=Y(),t=Ns(),s=Object.entries(t).map(([w,O])=>({value:w,label:O})),r={M:h("statusModified"),A:h("statusAdded"),D:h("statusDeleted"),R:h("statusRenamed"),"??":h("statusUntracked")},i=ve("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8"}).trim(),o=ar();if(E.info(`${h("currentBranch")}: ${i}`),E.info(`${h("filesChanged")}: ${o.length}`),o.length===0){let w=await le({message:h("noChangesPending")});if(A(w),!w)return}let a=$e();a.start(h("updatingRefs"));try{ve("git fetch --quiet"),a.stop(h("refsUpdated"))}catch{a.stop(h("fetchFailed"))}let l=await ue({message:F.secondary(h("baseBranch")),placeholder:e.defaultBaseBranch,initialValue:e.defaultBaseBranch,validate:w=>w?.trim()?void 0:h("baseBranchRequired")});A(l);let c=await ue({message:F.secondary(h("ticketId")),placeholder:"DPW-0000",validate:w=>w?.trim()?void 0:h("ticketRequired")});A(c);let u=await H({message:F.secondary(h("changeType")),options:s});A(u);let d=`${u}/${c}`;if(te("git",["branch","--list",d],{encoding:"utf-8"}).stdout.trim()){let w=await H({message:F.secondary(h("branchExistsLocal",d)),options:[{value:"checkout",label:h("switchToIt")},{value:"cancel",label:h("cancel")}]});if(A(w),w==="cancel"){E.warn(h("cancelledOp"));return}te("git",["checkout",d],{stdio:"inherit"})}else try{a.start(h("creatingBranch",d,l)),te("git",["checkout","-b",d,`origin/${l}`],{stdio:"pipe"}),a.stop(h("branchCreated",d))}catch(w){a.stop(""),E.error(h("errorCreatingBranch",w.message));return}let p=!1;for(;!p;){let w=ar();if(w.length===0){E.warn(h("noFilesToStage"));return}let O="__select_all__",q=w.map(ie=>{let be=ie.slice(0,2).trim(),it=or(ie),hr=r[be]??be;return{value:ie,label:it,hint:hr}}),S=await Pt({message:F.secondary(h("selectFiles")),options:[{value:O,label:F.primary(h("selectAllFiles"))},...q],required:!0});A(S);let B=S.includes(O)?w:S;te("git",["restore","--staged","."],{encoding:"utf-8"});for(let ie of B){let be=or(ie);te("git",["add",be],{encoding:"utf-8"})}let z=ve("git status --short",{encoding:"utf-8"}).trim();fe(z,h("stagedFiles"));let Q=await le({message:h("stagedCorrect")});A(Q),p=Q,p||te("git",["restore","--staged","."],{encoding:"utf-8"})}let y=ve("git diff --cached",{encoding:"utf-8"}),m=`Analiza el siguiente git diff y sugiere UN SOLO mensaje de commit en formato convencional.
|
|
170
170
|
|
|
171
|
-
Formato requerido: ${
|
|
171
|
+
Formato requerido: ${u}(${c}): descripcion en ingles
|
|
172
172
|
Reglas:
|
|
173
173
|
- Maximo 72 caracteres en total
|
|
174
174
|
- Verbo en presente ("add", "fix", "update", NO "added", "fixed")
|
|
@@ -177,10 +177,10 @@ Reglas:
|
|
|
177
177
|
- Responde UNICAMENTE con el mensaje de commit, sin explicaciones, sin comillas, sin markdown
|
|
178
178
|
|
|
179
179
|
Git diff:
|
|
180
|
-
${y}`,b=await
|
|
181
|
-
`).filter(Boolean).length,W=[`${h("summaryBranch")}: ${d}`,`${h("summaryFrom")}: origin/${
|
|
182
|
-
`),h("summaryTitle"))},
|
|
183
|
-
`);
|
|
180
|
+
${y}`,b=await H({message:F.secondary(h("aiProvider")),options:[{value:"claude",label:"Claude"},{value:"opencode",label:"Opencode"}],initialValue:e.aiProvider});A(b);let $={claude:{binary:"claude",args:["-p",m],label:"Claude"},opencode:{binary:"opencode",args:["run",m],label:"Opencode"}},{binary:v,args:C,label:T}=$[b];a.start(h("generatingCommit",T));let R=await new Promise(w=>{let O="",q="",S=zi(v,C,{stdio:["ignore","pipe","pipe"]});S.stdout.on("data",B=>{O+=B}),S.stderr.on("data",B=>{q+=B}),S.on("close",B=>w({status:B,stdout:O,stderr:q,error:null})),S.on("error",B=>w({status:1,stdout:"",stderr:"",error:B}))});a.stop("");let x;if(R.error||R.status!==0){E.warn(h("aiSuggestionFailed",T));let w=await ue({message:F.secondary(h("writeCommitMsg")),initialValue:`${u}(${c}): `,validate:O=>O?.trim()?void 0:h("commitMsgRequired")});A(w),x=w}else{let w=R.stdout.trim();fe(w,h("suggestionOf",T));let O=await H({message:F.secondary(h("useThisCommit")),options:[{value:"yes",label:h("yesUseIt")},{value:"modify",label:h("modify")}]});if(A(O),O==="yes")x=w;else{let q=await ue({message:F.secondary(h("writeCommitMsg")),initialValue:w,validate:S=>S?.trim()?void 0:h("commitMsgRequired")});A(q),x=q}}let L=!1;for(;!L;)if(te("git",["commit","-m",x],{stdio:"inherit"}).status===0)E.success(h("commitSuccess")),L=!0;else{let O=await H({message:F.secondary(h("hookBlocked")),options:[{value:"retry",label:h("retryHook")},{value:"noverify",label:h("skipHook")},{value:"cancel",label:h("cancel")}]});if(A(O),O==="cancel")return;O==="noverify"&&(te("git",["commit","--no-verify","-m",x],{stdio:"inherit"}),E.success(h("commitNoHooks")),L=!0),O==="retry"&&te("git",["add","-u"],{stdio:"inherit"})}let M=await le({message:h("pushToRemote")});A(M);let k="";if(M){let w=(S=!1)=>{te("git",S?["push","-f","origin",d]:["push","-u","origin",d],{stdio:"inherit"})},O=()=>{let S=ve("git remote get-url origin",{encoding:"utf-8"}).trim(),B=S.match(/[:/]([^/]+\/[^/]+?)(\.git)?$/),z=B?B[1]:"";return S.includes("github.com")?`https://github.com/${z}/compare/${d}?expand=1`:S.includes("bitbucket.org")?`https://bitbucket.org/${z}/pull-requests/new?source=${d}`:S.includes("gitlab.com")?`https://gitlab.com/${z}/-/merge_requests/new?merge_request[source_branch]=${d}`:""};if(te("git",["push","-u","origin",d],{stdio:"inherit"}).status===0)E.success(h("pushSuccess")),k=O();else{let S=await le({message:h("pushForceQuestion")});A(S),S&&(te("git",["push","-f","origin",d],{stdio:"inherit"}).status===0?(E.success(h("pushForceSuccess")),k=O()):E.error(h("pushForceError","push failed")))}}let N=ve('git diff --name-only HEAD~1 HEAD 2>/dev/null || git show --name-only --format="" HEAD',{encoding:"utf-8"}).trim().split(`
|
|
181
|
+
`).filter(Boolean).length,W=[`${h("summaryBranch")}: ${d}`,`${h("summaryFrom")}: origin/${l}`,`${h("summaryCommit")}: ${x}`,`${h("summaryFiles",N)}`,...M&&k?[`${h("summaryPush")}: origin/${d}`,`${h("summaryPR")}: ${k}`]:[]];fe(W.join(`
|
|
182
|
+
`),h("summaryTitle"))},cr=Ji;Z();async function tt(){let e=await H({message:F.secondary(h("configMenu")),options:[{value:"language",label:h("configLanguage")},{value:"defaultBranch",label:h("configDefaultBranch")},{value:"aiProvider",label:h("configAIProvider")},{value:"view",label:h("configView")}]});if(A(e),e==="language"){let t=await H({message:F.secondary(h("languageSelect")),options:Ds(),initialValue:Y().language});A(t),Qe({language:t}),E.success(h("languageChanged",t))}if(e==="defaultBranch"){let{text:t}=await Promise.resolve().then(()=>(Z(),Ms)),s=await t({message:F.secondary(h("baseBranch")),initialValue:Y().defaultBaseBranch,validate:r=>r?.trim()?void 0:h("baseBranchRequired")});A(s),Qe({defaultBaseBranch:s}),E.success(h("defaultBranchSet",s))}if(e==="aiProvider"){let t=await H({message:F.secondary(h("aiProvider")),options:[{value:"claude",label:"Claude"},{value:"opencode",label:"Opencode"}],initialValue:Y().aiProvider});A(t),Qe({aiProvider:t}),E.success(h("aiProviderSet",t))}if(e==="view"){let t=Y(),s=Object.entries(t).map(([r,i])=>` ${r}: ${i}`).join(`
|
|
183
|
+
`);fe(s,F.secondary(h("currentConfig")))}}import{readFileSync as Yi}from"fs";import{fileURLToPath as Qi}from"url";import{dirname as Xi,resolve as Zi}from"path";var en=()=>{let e=Qi(import.meta.url),t=Xi(e);return JSON.parse(Yi(Zi(t,"../package.json"),"utf8"))?.version},lr=en;Z();import{existsSync as tn}from"fs";import{join as sn}from"path";import{execSync as rn}from"child_process";var nn=()=>{try{rn("git --version",{stdio:"ignore"})}catch{E.error(h("gitNotInstalled")),process.exit(1)}let e=sn(process.cwd(),".git");tn(e)||(E.error(h("notGitRepo")),process.exit(1))},ur=nn;var rt=process.argv.slice(2);(rt.includes("-v")||rt.includes("--version"))&&(console.log(`${h("version")}: ${lr()}`),process.exit(0));(rt.includes("config")||rt.includes("--config"))&&(await tt(),process.exit(0));ur();kt(F.primary(`
|
|
184
184
|
${h("welcome")}
|
|
185
185
|
|
|
186
186
|
.-------------------------------------------------------------------------------.
|
|
@@ -194,5 +194,5 @@ ${y}`,b=await K({message:O.secondary(h("aiProvider")),options:[{value:"claude",l
|
|
|
194
194
|
|\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591 |
|
|
195
195
|
'-------------------------------------------------------------------------------'
|
|
196
196
|
|
|
197
|
-
${
|
|
198
|
-
`));var
|
|
197
|
+
${F.muted(h("subtitle"))}
|
|
198
|
+
`));var st=await H({message:F.secondary(h("whatToDo")),options:[{value:"ACB",label:h("addChanges")},{value:"CRO",label:h("createOriginal")},{value:"CRT",label:h("createTemporal")},{value:"CFG",label:h("configMenu")}],required:!0,initialValue:"ACB"});st==="ACB"?await cr():st==="CRO"?await sr():st==="CRT"?await nr():st==="CFG"?await tt():(Me(h("operationCancelled")),process.exit(0));Lt(F.success(h("operationCompleted")));
|