eazy-git 0.2.11 → 0.2.12
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 +4 -1
- package/dist/git.js +11 -11
- package/dist/index.js +130 -130
- package/dist/install.js +19 -19
- package/dist/run.js +2 -2
- 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&&(
|
|
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+
|
|
8
|
-
`),
|
|
9
|
-
`),i=Math.max(
|
|
10
|
-
`).map((
|
|
11
|
-
`)}function
|
|
12
|
-
`),
|
|
13
|
-
`).length-1;this.output.write(
|
|
14
|
-
`);this.output.write(a[o]),this._prevFrame=e,this.output.write(
|
|
2
|
+
var ps=Object.create;var ot=Object.defineProperty;var gs=Object.getOwnPropertyDescriptor;var fs=Object.getOwnPropertyNames;var $s=Object.getPrototypeOf,ys=Object.prototype.hasOwnProperty;var Ie=(e,t)=>()=>(e&&(t=e(e=0)),t);var vs=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),bs=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},ws=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fs(t))!ys.call(e,i)&&i!==r&&ot(e,i,{get:()=>t[i],enumerable:!(s=gs(t,i))||s.enumerable});return e};var Ht=(e,t,r)=>(r=e!=null?ps($s(e)):{},ws(t||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e));var zt,Kt,Jt,Yt=Ie(()=>{zt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Kt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Jt=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 Cs,Is,Qt,Ss,Xt,Es,xs,Rs,Zt,er,tr=Ie(()=>{Yt();Cs=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Is=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Qt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Ss=/\t{1,1000}/y,Xt=/[\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,Es=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,xs=/\p{M}+/gu,Rs={limit:1/0,ellipsis:""},Zt=(e,t={},r={})=>{let s=t.limit??1/0,i=t.ellipsis??"",o=t?.ellipsisWidth??(i?Zt(i,Rs,r).width:0),a=0,u=r.controlWidth??0,c=r.tabWidth??8,l=r.emojiWidth??2,d=2,g=r.regularWidth??1,p=r.wideWidth??d,y=[[Es,g],[Cs,a],[Is,u],[Ss,c],[Xt,l],[Qt,p]],m=0,b=0,$=e.length,v=0,C=!1,R=$,T=Math.max(0,s-o),x=0,L=0,M=0,B=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(xs,"")){let w=W.codePointAt(0)||0;if(Kt(w)?B=d:Jt(w)?B=p:B=g,M+B>T&&(R=Math.min(R,Math.max(x,m)+v)),M+B>s){C=!0;break e}v+=W.length,M+=B}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===Qt?zt(e.slice(b,w.lastIndex)):w===Xt?1:w.lastIndex-b,B=v*O,M+B>T&&(R=Math.min(R,b+Math.floor((T-M)/O))),M+B>s){C=!0;break e}M+=B,x=m,L=b,b=m=w.lastIndex;continue e}}b+=1}return{width:C?T:M,index:C?R:$,truncated:C,ellipsed:C&&s>=o}},er=Zt});var Ts,_s,j,at=Ie(()=>{tr();Ts={limit:1/0,ellipsis:"",ellipsisWidth:0},_s=(e,t={})=>er(e,Ts,t).width,j=_s});function re(e,t,r){return String(e).normalize().split(ks).map(s=>Os(s,t,r)).join(`
|
|
3
|
+
`)}var Ne,or,As,ut,ar,Fs,cr,lt,rr,sr,ir,nr,ct,Ms,Os,ks,ht=Ie(()=>{at();Ne="\x1B",or="\x9B",As=39,ut="\x07",ar="[",Fs="]",cr="m",lt=`${Fs}8;;`,rr=new RegExp(`(?:\\${ar}(?<code>\\d+)m|\\${lt}(?<uri>.*)${ut})`,"y"),sr=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},ir=e=>`${Ne}${ar}${e}${cr}`,nr=e=>`${Ne}${lt}${e}${ut}`,ct=(e,t,r)=>{let s=t[Symbol.iterator](),i=!1,o=!1,a=e.at(-1),u=a===void 0?0:j(a),c=s.next(),l=s.next(),d=0;for(;!c.done;){let g=c.value,p=j(g);u+p<=r?e[e.length-1]+=g:(e.push(g),u=0),(g===Ne||g===or)&&(i=!0,o=t.startsWith(lt,d+1)),i?o?g===ut&&(i=!1,o=!1):g===cr&&(i=!1):(u+=p,u===r&&!l.done&&(e.push(""),u=0)),c=l,l=s.next(),d+=g.length}a=e.at(-1),!u&&a!==void 0&&a.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ms=e=>{let t=e.split(" "),r=t.length;for(;r&&!j(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Os=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let s="",i,o,a=e.split(" "),u=[""],c=0;for(let g=0;g<a.length;g++){let p=a[g];if(r.trim!==!1){let m=u.at(-1)??"",b=m.trimStart();m.length!==b.length&&(u[u.length-1]=b,c=j(b))}g!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(u.push(""),c=0),(c||r.trim===!1)&&(u[u.length-1]+=" ",c++));let y=j(p);if(r.hard&&y>t){let m=t-c,b=1+Math.floor((y-m-1)/t);Math.floor((y-1)/t)<b&&u.push(""),ct(u,p,t),c=j(u.at(-1)??"");continue}if(c+y>t&&c&&y){if(r.wordWrap===!1&&c<t){ct(u,p,t),c=j(u.at(-1)??"");continue}u.push(""),c=0}if(c+y>t&&r.wordWrap===!1){ct(u,p,t),c=j(u.at(-1)??"");continue}u[u.length-1]+=p,c+=y}r.trim!==!1&&(u=u.map(g=>Ms(g)));let l=u.join(`
|
|
4
|
+
`),d=!1;for(let g=0;g<l.length;g++){let p=l[g];if(s+=p,d)d=!1;else if(d=p>="\uD800"&&p<="\uDBFF",d)continue;if(p===Ne||p===or){rr.lastIndex=g+1;let m=rr.exec(l)?.groups;if(m?.code!==void 0){let b=Number.parseFloat(m.code);i=b===As?void 0:b}else m?.uri!==void 0&&(o=m.uri.length===0?void 0:m.uri)}if(l[g+1]===`
|
|
5
|
+
`){o&&(s+=nr(""));let y=i?sr(i):void 0;i&&y&&(s+=ir(y))}else p===`
|
|
6
|
+
`&&(i&&sr(i)&&(s+=ir(i)),o&&(s+=nr(o)))}return s},ks=/\r?\n/});var pt=vs((fn,ur)=>{"use strict";var dt="\x1B",D=`${dt}[`,Bs="\x07",mt={to(e,t){return t?`${D}${t+1};${e+1}H`:`${D}${e+1}G`},move(e,t){let r="";return e<0?r+=`${D}${-e}D`:e>0&&(r+=`${D}${e}C`),t<0?r+=`${D}${-t}A`:t>0&&(r+=`${D}${t}B`),r},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:`${dt}7`,restore:`${dt}8`},Ls={up:(e=1)=>`${D}S`.repeat(e),down:(e=1)=>`${D}T`.repeat(e)},Ps={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 r=0;r<e;r++)t+=this.line+(r<e-1?mt.up():"");return e&&(t+=mt.left),t}};ur.exports={cursor:mt,scroll:Ls,erase:Ps,beep:Bs}});import{styleText as Se}from"node:util";import{stdout as yt,stdin as mr}from"node:process";import*as ce from"node:readline";import Ns from"node:readline";import{ReadStream as lr}from"node:tty";function oe(e,t,r){if(!r.some(a=>!a.disabled))return e;let s=e+t,i=Math.max(r.length-1,0),o=s<0?i:s>i?0:s;return r[o].disabled?oe(o,t<0?-1:1,r):o}function De(e,t,r,s){let i=s.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+r)),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 u=0;for(let c=0;c<o;c++)u+=i[c].length+1;return u+a}function pr(e){if(e.aliases!==void 0){let t=e.aliases;for(let r in t){if(!Object.hasOwn(t,r))continue;let s=t[r];S.actions.has(s)&&(S.aliases.has(r)||S.aliases.set(r,s))}}if(e.messages!==void 0){let t=e.messages;t.cancel!==void 0&&(S.messages.cancel=t.cancel),t.error!==void 0&&(S.messages.error=t.error)}if(e.withGuide!==void 0&&(S.withGuide=e.withGuide!==!1),e.date!==void 0){let t=e.date;t.monthNames!==void 0&&(S.date.monthNames=[...t.monthNames]),t.messages!==void 0&&(t.messages.required!==void 0&&(S.date.messages.required=t.messages.required),t.messages.invalidMonth!==void 0&&(S.date.messages.invalidMonth=t.messages.invalidMonth),t.messages.invalidDay!==void 0&&(S.date.messages.invalidDay=t.messages.invalidDay),t.messages.afterMin!==void 0&&(S.date.messages.afterMin=t.messages.afterMin),t.messages.beforeMax!==void 0&&(S.date.messages.beforeMax=t.messages.beforeMax))}}function vt(e,t){if(typeof e=="string")return S.aliases.get(e)===t;for(let r of e)if(r!==void 0&&vt(r,t))return!0;return!1}function Us(e,t){if(e===t)return;let r=e.split(`
|
|
8
|
+
`),s=t.split(`
|
|
9
|
+
`),i=Math.max(r.length,s.length),o=[];for(let a=0;a<i;a++)r[a]!==s[a]&&o.push(a);return{lines:o,numLinesBefore:r.length,numLinesAfter:s.length,numLines:i}}function Ee(e){return e===ft}function Ve(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function gr({input:e=mr,output:t=yt,overwrite:r=!0,hideCursor:s=!0}={}){let i=ce.createInterface({input:e,output:t,prompt:"",tabSize:1});ce.emitKeypressEvents(e,i),e instanceof lr&&e.isTTY&&e.setRawMode(!0);let o=(a,{name:u,sequence:c})=>{let l=String(a);if(vt([l,u,c],"cancel")){s&&t.write(z.cursor.show),process.exit(0);return}if(!r)return;ce.moveCursor(t,u==="return"?0:-1,u==="return"?-1:0,()=>{ce.clearLine(t,1,()=>{e.once("keypress",o)})})};return s&&t.write(z.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),s&&t.write(z.cursor.show),e instanceof lr&&e.isTTY&&!Gs&&e.setRawMode(!1),i.terminal=!1,i.close()}}function G(e,t,r,s=r,i=r,o){let a=pe(e??yt);return re(t,a-r.length,{hard:!0,trim:!1}).split(`
|
|
10
|
+
`).map((u,c,l)=>{let d=o?o(u,c):u;return c===0?`${s}${d}`:c===l.length-1?`${i}${d}`:`${r}${d}`}).join(`
|
|
11
|
+
`)}function js(e,t){if(e===void 0||t.length===0)return 0;let r=t.findIndex(s=>s.value===e);return r!==-1?r:0}function Ws(e,t){return(t.label??String(t.value)).toLowerCase().includes(e.toLowerCase())}function qs(e,t){if(t)return e?t:t[0]}function hr(e){return[...e].map(t=>Hs[t])}function zs(e){let t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2e3,0,15)),r=[],s="/";for(let i of t)i.type==="literal"?s=i.value.trim()||i.value:(i.type==="year"||i.type==="month"||i.type==="day")&&r.push({type:i.type,len:i.type==="year"?4:2});return{segments:r,separator:s}}function gt(e){return Number.parseInt((e||"0").replace(/_/g,"0"),10)||0}function Ue(e){return{year:gt(e.year),month:gt(e.month),day:gt(e.day)}}function $t(e,t){return new Date(e||2001,t||1,0).getDate()}function fr(e){let{year:t,month:r,day:s}=Ue(e);if(!t||t<0||t>9999||!r||r<1||r>12||!s||s<1)return;let i=new Date(Date.UTC(t,r-1,s));if(!(i.getUTCFullYear()!==t||i.getUTCMonth()!==r-1||i.getUTCDate()!==s))return{year:t,month:r,day:s}}function dr(e){let t=fr(e);return t?new Date(Date.UTC(t.year,t.month-1,t.day)):void 0}function Ks(e,t,r,s){let i=r?{year:r.getUTCFullYear(),month:r.getUTCMonth()+1,day:r.getUTCDate()}:null,o=s?{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.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:$t(t.year,t.month)}}var z,Ds,Vs,S,Gs,ft,pe,bt,ne,wt,Ge,Hs,je,We,qe,$r,He,ze,Ke,Je,Ct=Ie(()=>{ht();z=Ht(pt(),1);Ds=["up","down","left","right","space","enter","cancel"],Vs=["January","February","March","April","May","June","July","August","September","October","November","December"],S={actions:new Set(Ds),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:[...Vs],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)}`}}};Gs=globalThis.process.platform.startsWith("win"),ft=Symbol("clack:cancel");pe=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,bt=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:r=mr,output:s=yt,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=r,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],s=[];for(let i of r)i.cb(...t),i.once&&s.push(()=>r.splice(r.indexOf(i),1));for(let i of s)i()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(ft);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Ns.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),Ve(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(z.cursor.show),this.output.off("resize",this.render),Ve(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(z.cursor.show),this.output.off("resize",this.render),Ve(this.input,!1),e(ft)})})}_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&&S.aliases.has(t.name)&&this.emit("cursor",S.aliases.get(t.name)),S.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 r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}vt([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
|
+
`),Ve(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=re(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
13
|
+
`).length-1;this.output.write(z.cursor.move(-999,e*-1))}render(){let e=re(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(z.cursor.hide);else{let t=Us(this._prevFrame,e),r=bt(this.output);if(this.restoreCursor(),t){let s=Math.max(0,t.numLinesAfter-r),i=Math.max(0,t.numLinesBefore-r),o=t.lines.find(a=>a>=s);if(o===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(z.cursor.move(0,o-i)),this.output.write(z.erase.lines(1));let a=e.split(`
|
|
14
|
+
`);this.output.write(a[o]),this._prevFrame=e,this.output.write(z.cursor.move(0,a.length-o-1));return}else if(t.lines.length>1){if(s<i)o=s;else{let u=o-i;u>0&&this.output.write(z.cursor.move(0,u))}this.output.write(z.erase.down());let a=e.split(`
|
|
15
15
|
`).slice(o);this.output.write(a.join(`
|
|
16
|
-
`)),this._prevFrame=e;return}}this.output.write(
|
|
17
|
-
`?`${
|
|
18
|
-
${i}`:`${
|
|
19
|
-
`),this._cursor++,!1);let
|
|
16
|
+
`)),this._prevFrame=e;return}}this.output.write(z.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};wt=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 Se(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let e=this.userInput.slice(0,this._cursor),[t,...r]=this.userInput.slice(this._cursor);return`${e}${Se("inverse",t)}${r.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??Ws;let r;if(e.initialValue&&Array.isArray(e.initialValue)?this.multiple?r=e.initialValue:r=e.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(r=[this.options[0].value]),r)for(let s of r){let i=t.findIndex(o=>o.value===s);i!==-1&&(this.toggleSelected(s),this.#t=i)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(s,i)=>this.#r(s,i)),this.on("userInput",s=>this.#s(s))}_isActionKey(e,t){return e===" "||this.multiple&&this.isNavigating&&t.name==="space"&&e!==void 0&&e!==""}#r(e,t){let r=t.name==="up",s=t.name==="down",i=t.name==="return",o=this.userInput===""||this.userInput===" ",a=this.#a,u=this.options,c=a!==void 0&&a!==""&&u.some(l=>!l.disabled&&(this.#e?this.#e(a,l):!0));if(t.name==="tab"&&o&&c){this.userInput===" "&&this._clearUserInput(),this._setUserInput(a,!0),this.isNavigating=!1;return}r||s?(this.#t=oe(this.#t,r?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):i?this.value=qs(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])}#s(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 r=js(this.focusedValue,this.filteredOptions);this.#t=oe(r,0,this.filteredOptions);let s=this.filteredOptions[this.#t];s&&!s.disabled?this.focusedValue=s.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},Ge=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",r=>{this.output.write(z.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Hs={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};je=class extends ne{#t;#i;#e;#n;#a;#r={segmentIndex:0,positionInSegment:0};#s=!0;#o=null;inlineError="";get segmentCursor(){return{...this.#r}}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(r=>t[r.type]).join(this.#i)}#c(){this._setUserInput(this.#h(this.#e)),this._setValue(dr(this.#e)??void 0)}constructor(t){let r=t.format?{segments:hr(t.format),separator:t.separator??"/"}:zs(t.locale),s=t.separator??r.separator,i=t.format?hr(t.format):r.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:"__"},u=i.map(c=>a[c.type]).join(s);super({...t,initialUserInput:u},!1),this.#t=i,this.#i=s,this.#e=a,this.#n=t.minDate,this.#a=t.maxDate,this.#c(),this.on("cursor",c=>this.#p(c)),this.on("key",(c,l)=>this.#g(c,l)),this.on("finalize",()=>this.#f(t))}#u(){let t=Math.max(0,Math.min(this.#r.segmentIndex,this.#t.length-1)),r=this.#t[t];if(r)return this.#r.positionInSegment=Math.max(0,Math.min(this.#r.positionInSegment,r.len-1)),{segment:r,index:t}}#l(t){this.inlineError="",this.#o=null;let r=this.#u();r&&(this.#r.segmentIndex=Math.max(0,Math.min(this.#t.length-1,r.index+t)),this.#r.positionInSegment=0,this.#s=!0)}#d(t){let r=this.#u();if(!r)return;let{segment:s}=r,i=this.#e[s.type],o=!i||i.replace(/_/g,"")==="",a=Number.parseInt((i||"0").replace(/_/g,"0"),10)||0,u=Ks(s.type,Ue(this.#e),this.#n,this.#a),c;o?c=t===1?u.min:u.max:c=Math.max(Math.min(u.max,a+t),u.min),this.#e={...this.#e,[s.type]:c.toString().padStart(s.len,"0")},this.#s=!0,this.#o=null,this.#c()}#p(t){if(t)switch(t){case"right":return this.#l(1);case"left":return this.#l(-1);case"up":return this.#d(1);case"down":return this.#d(-1)}}#g(t,r){if(r?.name==="backspace"||r?.sequence==="\x7F"||r?.sequence==="\b"||t==="\x7F"||t==="\b"){this.inlineError="";let s=this.#u();if(!s)return;if(!this.#e[s.segment.type].replace(/_/g,"")){this.#l(-1);return}this.#e[s.segment.type]="_".repeat(s.segment.len),this.#s=!0,this.#r.positionInSegment=0,this.#c();return}if(r?.name==="tab"){this.inlineError="";let s=this.#u();if(!s)return;let i=r.shift?-1:1,o=s.index+i;o>=0&&o<this.#t.length&&(this.#r.segmentIndex=o,this.#r.positionInSegment=0,this.#s=!0);return}if(t&&/^[0-9]$/.test(t)){let s=this.#u();if(!s)return;let{segment:i}=s,o=!this.#e[i.type].replace(/_/g,"");if(this.#s&&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.#s=!1;return}this.inlineError="",this.#e[i.type]=y,this.#o=null,this.#s=!1,this.#c(),s.index<this.#t.length-1&&(this.#r.segmentIndex=s.index+1,this.#r.positionInSegment=0,this.#s=!0);return}this.#s&&!o&&(this.#e[i.type]="_".repeat(i.len),this.#r.positionInSegment=0),this.#s=!1,this.#o=null;let a=this.#e[i.type],u=a.indexOf("_"),c=u>=0?u:Math.min(this.#r.positionInSegment,i.len-1);if(c<0||c>=i.len)return;let l=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);l=`0${t}`,d=y<=(i.type==="month"?1:2)}if(i.type==="year"&&(l=(a.replace(/_/g,"")+t).padStart(i.len,"_")),!l.includes("_")){let y={...this.#e,[i.type]:l},m=this.#m(y,i);if(m){this.inlineError=m;return}}this.inlineError="",this.#e[i.type]=l;let g=l.includes("_")?void 0:fr(this.#e);if(g){let{year:y,month:m}=g,b=$t(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=l.indexOf("_");d?(this.#s=!0,this.#o=t):p>=0?this.#r.positionInSegment=p:u>=0&&s.index<this.#t.length-1?(this.#r.segmentIndex=s.index+1,this.#r.positionInSegment=0,this.#s=!0):this.#r.positionInSegment=Math.min(c+1,i.len-1)}}#m(t,r){let{month:s,day:i}=Ue(t);if(r.type==="month"&&(s<0||s>12))return S.date.messages.invalidMonth;if(r.type==="day"&&(i<0||i>31))return S.date.messages.invalidDay(31,"any month")}#f(t){let{year:r,month:s,day:i}=Ue(this.#e);if(r&&s&&i){let o=$t(r,s);this.#e={...this.#e,day:String(Math.min(i,o)).padStart(2,"0")}}this.value=dr(this.#e)??t.defaultValue??void 0}},We=class extends ne{options;cursor=0;#t;getGroupItems(t){return this.options.filter(r=>r.group===t)}isGroupSelected(t){let r=this.getGroupItems(t),s=this.value;return s===void 0?!1:r.every(i=>s.includes(i.value))}toggleValue(){let t=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),t.group===!0){let r=t.value,s=this.getGroupItems(r);this.isGroupSelected(r)?this.value=this.value.filter(i=>s.findIndex(o=>o.value===i)===-1):this.value=[...this.value,...s.map(i=>i.value)],this.value=Array.from(new Set(this.value))}else{let r=this.value.includes(t.value);this.value=r?this.value.filter(s=>s!==t.value):[...this.value,t.value]}}constructor(t){super(t,!1);let{options:r}=t;this.#t=t.selectableGroups!==!1,this.options=Object.entries(r).flatMap(([s,i])=>[{value:s,group:!0,label:s},...i.map(o=>({...o,group:s}))]),this.value=[...t.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===t.cursorAt),this.#t?0:1),this.on("cursor",s=>{switch(s){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}})}},qe=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 r=t.slice(0,this.cursor),s=t[this.cursor],i=t.slice(this.cursor+1);return s===`
|
|
17
|
+
`?`${r}\u2588
|
|
18
|
+
${i}`:`${r}${Se("inverse",s)}${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 r=this.value??"";switch(t){case"up":this._cursor=De(this._cursor,0,-1,r);return;case"down":this._cursor=De(this._cursor,0,1,r);return;case"left":this._cursor=De(this._cursor,-1,0,r);return;case"right":this._cursor=De(this._cursor,1,0,r);return}}_shouldSubmit(t,r){if(this.#i)return this.focused==="submit"?!0:(this.#e(`
|
|
19
|
+
`),this._cursor++,!1);let s=this.#t;return this.#t=!0,s?(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
|
|
22
|
-
`);$.push(L),v+=L.length}if(v>d){let x=0,L=0,M=v,B=e-C,N=d,W=()=>
|
|
21
|
+
`),this._cursor++,!1)}constructor(t){super(t,!1),this.#i=t.showSubmit??!1,this.on("key",(r,s)=>{if(s?.name&&S.actions.has(s.name)){this.#n(s.name);return}if(r===" "&&this.#i){this.focused=this.focused==="editor"?"submit":"editor";return}if(s?.name!=="return"){if(this.#t=!1,s?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(s?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}r&&(this.#i&&this.focused==="submit"&&(this.focused="editor"),this.#e(r??""),this._cursor++)}}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}},$r=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(r=>r.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(r=>!e.includes(r.value));this.value=t.map(r=>r.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:r})=>r===e.cursorAt),0);this.cursor=this.options[t].disabled?oe(t,1,this.options):t,this.on("key",r=>{r==="a"&&this.toggleAll(),r==="i"&&this.toggleInvert()}),this.on("cursor",r=>{switch(r){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}})}},He=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}${Se(["inverse","hidden"],"_")}`;let r=this.masked,s=r.slice(0,this.cursor),i=r.slice(this.cursor);return`${s}${Se("inverse",i[0])}${i.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",s=>{this._setValue(s)})}},ze=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 r=this.options.findIndex(({value:i})=>i===t.initialValue),s=r===-1?0:r;this.cursor=this.options[s].disabled?oe(s,1,this.options):s,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()})}},Ke=class extends ne{options;cursor=0;constructor(t){super(t,!1),this.options=t.options;let r=t.caseSensitive===!0,s=this.options.map(({value:[i]})=>r?i:i?.toLowerCase());this.cursor=Math.max(s.indexOf(t.initialValue),0),this.on("key",(i,o)=>{if(!i)return;let a=r&&o.shift?i.toUpperCase():i;if(!s.includes(a))return;let u=this.options.find(({value:[c]})=>r?c===a:c?.toLowerCase()===i);u&&(this.value=u.value,this.state="submit",this.emit("submit"))})}},Je=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 r=t.slice(0,this.cursor),[s,...i]=t.slice(this.cursor);return`${r}${Se("inverse",s)}${i.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}});var kr={};bs(kr,{S_BAR:()=>f,S_BAR_END:()=>V,S_BAR_END_RIGHT:()=>Tr,S_BAR_H:()=>Ze,S_BAR_START:()=>Rt,S_BAR_START_RIGHT:()=>Rr,S_CHECKBOX_ACTIVE:()=>Xe,S_CHECKBOX_INACTIVE:()=>Re,S_CHECKBOX_SELECTED:()=>fe,S_CONNECT_LEFT:()=>Ar,S_CORNER_BOTTOM_LEFT:()=>At,S_CORNER_BOTTOM_RIGHT:()=>_t,S_CORNER_TOP_LEFT:()=>Fr,S_CORNER_TOP_RIGHT:()=>Tt,S_ERROR:()=>kt,S_INFO:()=>Ft,S_PASSWORD_MASK:()=>_r,S_RADIO_ACTIVE:()=>Oe,S_RADIO_INACTIVE:()=>$e,S_STEP_ACTIVE:()=>xr,S_STEP_CANCEL:()=>Et,S_STEP_ERROR:()=>xt,S_STEP_SUBMIT:()=>ye,S_SUCCESS:()=>Mt,S_WARN:()=>Ot,autocomplete:()=>Or,autocompleteMultiselect:()=>ei,box:()=>ii,cancel:()=>ke,confirm:()=>le,date:()=>ni,group:()=>ui,groupMultiselect:()=>li,intro:()=>Lt,isCI:()=>St,isCancel:()=>Ee,isTTY:()=>Er,limitOptions:()=>ue,log:()=>I,multiline:()=>hi,multiselect:()=>Nt,note:()=>ve,outro:()=>Pt,password:()=>pi,path:()=>gi,progress:()=>$i,select:()=>q,selectKey:()=>yi,settings:()=>S,spinner:()=>ae,stream:()=>ge,symbol:()=>J,symbolBar:()=>Bt,taskLog:()=>wi,tasks:()=>vi,text:()=>he,unicode:()=>Qe,unicodeOr:()=>F,updateSettings:()=>pr});import{styleText as n,stripVTControlCharacters as It}from"node:util";import Z from"node:process";import{existsSync as Js,lstatSync as yr,readdirSync as Ys}from"node:fs";import{dirname as vr,join as Qs}from"node:path";function Xs(){return Z.platform!=="win32"?Z.env.TERM!=="linux":!!Z.env.CI||!!Z.env.WT_SESSION||!!Z.env.TERMINUS_SUBLIME||Z.env.ConEmuTask==="{cmd::Cmder}"||Z.env.TERM_PROGRAM==="Terminus-Sublime"||Z.env.TERM_PROGRAM==="vscode"||Z.env.TERM==="xterm-256color"||Z.env.TERM==="alacritty"||Z.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function wr(e){return e.label??String(e.value??"")}function Mr(e,t){if(!e)return!0;let r=(t.label??String(t.value??"")).toLowerCase(),s=(t.hint??"").toLowerCase(),i=String(t.value).toLowerCase(),o=e.toLowerCase();return r.includes(o)||s.includes(o)||i.includes(o)}function Zs(e,t){let r=[];for(let s of t)e.includes(s.value)&&r.push(s);return r}function Cr(e,t,r,s){let i=r,o=r;return s==="center"?i=Math.floor((t-e)/2):s==="right"&&(i=t-e-r),o=t-i-e,[i,o]}function oi(e,t){let r=e.segmentValues,s=e.segmentCursor;if(t==="submit"||t==="cancel")return e.formattedValue;let i=n("gray",e.separator);return e.segments.map((o,a)=>{let u=a===s.segmentIndex&&!["submit","cancel"].includes(t),c=ci[o.type];return ai(r[o.type],{isActive:u,label:c})}).join(i)}function ai(e,t){let r=!e||e.replace(/_/g,"")==="";return t.isActive?n("inverse",r?t.label:e.replace(/_/g," ")):r?n("dim",t.label):e.replace(/_/g,n("dim"," "))}function $i({style:e="heavy",max:t=100,size:r=40,...s}={}){let i=ae(s),o=0,a="",u=Math.max(1,t),c=Math.max(1,r),l=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/u*c);return`${l(y)(Ir[e].repeat(b))}${n("dim",Ir[e].repeat(c-b))} ${m}`},g=(y="")=>{a=y,i.start(d("initial",y))},p=(y=1,m)=>{o=Math.min(u,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 xe,Qe,St,Er,F,xr,Et,xt,ye,Rt,f,V,Rr,Tr,Oe,$e,Xe,fe,Re,_r,Ze,Tt,Ar,_t,At,Fr,Ft,Mt,Ot,kt,J,Bt,br,ue,Or,ei,ti,ri,si,ii,le,ni,ci,ui,li,I,ke,Lt,Pt,hi,Me,Nt,di,mi,ve,pi,gi,fi,ae,Ir,Ye,q,yi,Sr,ge,vi,bi,wi,he,Y=Ie(()=>{Ct();Ct();ht();at();xe=Ht(pt(),1);Qe=Xs(),St=()=>process.env.CI==="true",Er=e=>e.isTTY===!0,F=(e,t)=>Qe?e:t,xr=F("\u25C6","*"),Et=F("\u25A0","x"),xt=F("\u25B2","x"),ye=F("\u25C7","o"),Rt=F("\u250C","T"),f=F("\u2502","|"),V=F("\u2514","\u2014"),Rr=F("\u2510","T"),Tr=F("\u2518","\u2014"),Oe=F("\u25CF",">"),$e=F("\u25CB"," "),Xe=F("\u25FB","[\u2022]"),fe=F("\u25FC","[+]"),Re=F("\u25FB","[ ]"),_r=F("\u25AA","\u2022"),Ze=F("\u2500","-"),Tt=F("\u256E","+"),Ar=F("\u251C","+"),_t=F("\u256F","+"),At=F("\u2570","+"),Fr=F("\u256D","+"),Ft=F("\u25CF","\u2022"),Mt=F("\u25C6","*"),Ot=F("\u25B2","!"),kt=F("\u25A0","x"),J=e=>{switch(e){case"initial":case"active":return n("cyan",xr);case"cancel":return n("red",Et);case"error":return n("yellow",xt);case"submit":return n("green",ye)}},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)}},br=(e,t,r,s,i,o=!1)=>{let a=t,u=0;if(o)for(let c=s-1;c>=r&&(a-=e[c].length,u++,!(a<=i));c--);else for(let c=r;c<s&&(a-=e[c].length,u++,!(a<=i));c++);return{lineCount:a,removals:u}},ue=({cursor:e,options:t,style:r,output:s=process.stdout,maxItems:i=Number.POSITIVE_INFINITY,columnPadding:o=0,rowPadding:a=4})=>{let u=pe(s)-o,c=bt(s),l=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),R=b-(m?1:0);for(let x=C;x<R;x++){let L=re(r(t[x],x===e),u,{hard:!0,trim:!1}).split(`
|
|
22
|
+
`);$.push(L),v+=L.length}if(v>d){let x=0,L=0,M=v,B=e-C,N=d,W=()=>br($,M,0,B,N),w=()=>br($,M,B+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 T=[];y&&T.push(l);for(let x of $)for(let L of x)T.push(L);return m&&T.push(l),T};Or=e=>new wt({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,placeholder:e.placeholder,filter:e.filter??((t,r)=>Mr(t,r)),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){let t=e.withGuide??S.withGuide,r=t?[`${n("gray",f)}`,`${J(this.state)} ${e.message}`]:[`${J(this.state)} ${e.message}`],s=this.userInput,i=this.options,o=e.placeholder,a=s===""&&o!==void 0,u=(c,l)=>{let d=wr(c),g=c.hint&&c.value===this.focusedValue?n("dim",` (${c.hint})`):"";switch(l){case"active":return`${n("green",Oe)} ${d}${g}`;case"inactive":return`${n("dim",$e)} ${n("dim",d)}`;case"disabled":return`${n("gray",$e)} ${n(["strikethrough","gray"],d)}`}};switch(this.state){case"submit":{let c=Zs(this.selectedValues,i),l=c.length>0?` ${n("dim",c.map(wr).join(", "))}`:"",d=t?n("gray",f):"";return`${r.join(`
|
|
23
23
|
`)}
|
|
24
|
-
${d}${
|
|
24
|
+
${d}${l}`}case"cancel":{let c=s?` ${n(["strikethrough","dim"],s)}`:"",l=t?n("gray",f):"";return`${r.join(`
|
|
25
25
|
`)}
|
|
26
|
-
${
|
|
27
|
-
`)}}}}).prompt(),
|
|
26
|
+
${l}${c}`}default:{let c=this.state==="error"?"yellow":"cyan",l=t?`${n(c,f)} `:"",d=t?n(c,V):"",g="";if(this.isNavigating||a){let C=a?o:s;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&&s?[`${l}${n("yellow","No matches found")}`]:[],m=this.state==="error"?[`${l}${n("yellow",this.error)}`]:[];t&&r.push(`${l.trimEnd()}`),r.push(`${l}${n("dim","Search:")}${g}${p}`,...y,...m);let b=[`${n("dim","\u2191/\u2193")} to select`,`${n("dim","Enter:")} confirm`,`${n("dim","Type:")} to search`],$=[`${l}${b.join(" \u2022 ")}`,d],v=this.filteredOptions.length===0?[]:ue({cursor:this.cursor,options:this.filteredOptions,columnPadding:t?3:0,rowPadding:r.length+$.length,style:(C,R)=>u(C,C.disabled?"disabled":R?"active":"inactive"),maxItems:e.maxItems,output:e.output});return[...r,...v.map(C=>`${l}${C}`),...$].join(`
|
|
27
|
+
`)}}}}).prompt(),ei=e=>{let t=(s,i,o,a)=>{let u=o.includes(s.value),c=s.label??String(s.value??""),l=s.hint&&a!==void 0&&s.value===a?n("dim",` (${s.hint})`):"",d=u?n("green",fe):n("dim",Re);return s.disabled?`${n("gray",Re)} ${n(["strikethrough","gray"],c)}`:i?`${d} ${c}${l}`:`${d} ${n("dim",c)}`},r=new wt({options:e.options,multiple:!0,placeholder:e.placeholder,filter:e.filter??((s,i)=>Mr(s,i)),validate:()=>{if(e.required&&r.selectedValues.length===0)return"Please select at least one item"},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){let s=e.withGuide??S.withGuide,i=`${s?`${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],R=
|
|
31
|
-
`)}}}});return
|
|
32
|
-
`),W=b+a*2;for(let O of N){let H=j(O)+
|
|
29
|
+
`,o=this.userInput,a=e.placeholder,u=o===""&&a!==void 0,c=this.isNavigating||u?n("dim",u?a:o):this.userInputWithCursor,l=this.options,d=this.filteredOptions.length!==l.length?n("dim",` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${s?`${n("gray",f)} `:""}${n("dim",`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${s?`${n("gray",f)} `:""}${n(["strikethrough","dim"],o)}`;default:{let g=this.state==="error"?"yellow":"cyan",p=s?`${n(g,f)} `:"",y=s?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}${s?n(g,f):""}`.split(`
|
|
30
|
+
`),`${p}${n("dim","Search:")} ${c}${d}`,...b,...$],C=[`${p}${m.join(" \u2022 ")}`,y],R=ue({cursor:this.cursor,options:this.filteredOptions,style:(T,x)=>t(T,x,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output,rowPadding:v.length+C.length});return[...v,...R.map(T=>`${p}${T}`),...C].join(`
|
|
31
|
+
`)}}}});return r.prompt()},ti=[Fr,Tt,At,_t],ri=[Rt,Rr,V,Tr];si=e=>e,ii=(e="",t="",r)=>{let s=r?.output??process.stdout,i=pe(s),o=2,a=r?.titlePadding??1,u=r?.contentPadding??2,c=r?.width===void 0||r.width==="auto"?1:Math.min(1,r.width),l=r?.withGuide??S.withGuide?`${f} `:"",d=r?.formatBorder??si,g=(r?.rounded?ti:ri).map(d),p=d(Ze),y=d(f),m=j(l),b=j(t),$=i-m,v=Math.floor(i*c)-m;if(r?.width==="auto"){let N=e.split(`
|
|
32
|
+
`),W=b+a*2;for(let O of N){let H=j(O)+u*2;H>W&&(W=H)}let w=W+o;w<v&&(v=w)}v%2!==0&&(v<$?v++:v--);let C=v-o,R=C-a*2,T=b>R?`${t.slice(0,R-3)}...`:t,[x,L]=Cr(j(T),C,a,r?.titleAlign),M=re(e,C-u*2,{hard:!0,trim:!1});s.write(`${l}${g[0]}${p.repeat(x)}${T}${p.repeat(L)}${g[1]}
|
|
33
33
|
`);let B=M.split(`
|
|
34
|
-
`);for(let N of B){let[W,w]=
|
|
35
|
-
`)}
|
|
36
|
-
`)},le=e=>{let t=e.active??"Yes",
|
|
34
|
+
`);for(let N of B){let[W,w]=Cr(j(N),C,u,r?.contentAlign);s.write(`${l}${y}${" ".repeat(W)}${N}${" ".repeat(w)}${y}
|
|
35
|
+
`)}s.write(`${l}${g[2]}${p.repeat(C)}${g[3]}
|
|
36
|
+
`)},le=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new Ge({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let s=e.withGuide??S.withGuide,i=`${J(this.state)} `,o=s?`${n("gray",f)} `:"",a=G(e.output,e.message,o,i),u=`${s?`${n("gray",f)}
|
|
37
37
|
`:""}${a}
|
|
38
|
-
`,c=this.value?t:
|
|
39
|
-
${n("gray",f)}`:""}`}default:{let
|
|
38
|
+
`,c=this.value?t:r;switch(this.state){case"submit":{let l=s?`${n("gray",f)} `:"";return`${u}${l}${n("dim",c)}`}case"cancel":{let l=s?`${n("gray",f)} `:"";return`${u}${l}${n(["strikethrough","dim"],c)}${s?`
|
|
39
|
+
${n("gray",f)}`:""}`}default:{let l=s?`${n("cyan",f)} `:"",d=s?n("cyan",V):"";return`${u}${l}${this.value?`${n("green",Oe)} ${t}`:`${n("dim",$e)} ${n("dim",t)}`}${e.vertical?s?`
|
|
40
40
|
${n("cyan",f)} `:`
|
|
41
|
-
`:` ${n("dim","/")} `}${this.value?`${n("dim"
|
|
41
|
+
`:` ${n("dim","/")} `}${this.value?`${n("dim",$e)} ${n("dim",r)}`:`${n("green",Oe)} ${r}`}
|
|
42
42
|
${d}
|
|
43
|
-
`}}}}).prompt()},
|
|
43
|
+
`}}}}).prompt()},ni=e=>{let t=e.validate;return new je({...e,validate(r){if(r===void 0)return e.defaultValue!==void 0?void 0:t?t(r):S.date.messages.required;let s=i=>i.toISOString().slice(0,10);if(e.minDate&&s(r)<s(e.minDate))return S.date.messages.afterMin(e.minDate);if(e.maxDate&&s(r)>s(e.maxDate))return S.date.messages.beforeMax(e.maxDate);if(t)return t(r)},render(){let r=(e?.withGuide??S.withGuide)!==!1,s=`${`${r?`${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=oi(this,i),a=this.value instanceof Date?this.formattedValue:"";switch(this.state){case"error":{let u=this.error?` ${n("yellow",this.error)}`:"",c=r?`${n("yellow",f)} `:"",l=r?n("yellow",V):"";return`${s.trim()}
|
|
46
46
|
${c}${o}
|
|
47
|
-
${
|
|
48
|
-
`}case"submit":{let
|
|
49
|
-
${c}`:""}`}default:{let
|
|
50
|
-
${
|
|
47
|
+
${l}${u}
|
|
48
|
+
`}case"submit":{let u=a?` ${n("dim",a)}`:"",c=r?n("gray",f):"";return`${s}${c}${u}`}case"cancel":{let u=a?` ${n(["strikethrough","dim"],a)}`:"",c=r?n("gray",f):"";return`${s}${c}${u}${a.trim()?`
|
|
49
|
+
${c}`:""}`}default:{let u=r?`${n("cyan",f)} `:"",c=r?n("cyan",V):"",l=r?`${n("cyan",f)} `:"",d=this.inlineError?`
|
|
50
|
+
${l}${n("yellow",this.inlineError)}`:"";return`${s}${u}${o}${d}
|
|
51
51
|
${c}
|
|
52
|
-
`}}}}).prompt()};
|
|
53
|
-
`.repeat(
|
|
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??
|
|
52
|
+
`}}}}).prompt()};ci={year:"yyyy",month:"mm",day:"dd"},ui=async(e,t)=>{let r={},s=Object.keys(e);for(let i of s){let o=e[i],a=await o({results:r})?.catch(u=>{throw u});if(typeof t?.onCancel=="function"&&Ee(a)){r[i]="canceled",t.onCancel({results:r});continue}r[i]=a}return r},li=e=>{let{selectableGroups:t=!0,groupSpacing:r=0}=e,s=(o,a,u=[])=>{let c=o.label??String(o.value),l=typeof o.group=="string",d=l&&(u[u.indexOf(o)+1]??{group:!0}),g=l&&d&&d.group===!0,p="",y="";l&&(t?(p=g?`${V} `:`${f} `,y=g?" ":`${f} `):p=" ");let m="";if(r>0&&!l&&(m=`
|
|
53
|
+
`.repeat(r)),a==="active")return G(e.output,`${c}${o.hint?` ${n("dim",`(${o.hint})`)}`:""}`,`${m}${n("dim",p)} `,`${m}${n("dim",p)}${n("cyan",Xe)} `,`${m}${n("dim",y)} `);if(a==="group-active")return G(e.output,c,`${m}${p} `,`${m}${p}${n("cyan",Xe)} `,`${m}${y} `,$=>n("dim",$));if(a==="group-active-selected")return G(e.output,c,`${m}${p} `,`${m}${p}${n("green",fe)} `,`${m}${y} `,$=>n("dim",$));if(a==="selected"){let $=l||t?n("green",fe):"";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",fe)} `,`${m}${n("dim",y)} `);if(a==="submitted")return`${n("dim",c)}`;let b=l||t?n("dim",Re):"";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 We({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
|
+
${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??S.withGuide,a=`${o?`${n("gray",f)}
|
|
55
55
|
`:""}${J(this.state)} ${e.message}
|
|
56
|
-
`,
|
|
57
|
-
${n("gray",f)}`:""}`:""}`}case"error":{let
|
|
56
|
+
`,u=this.value??[],c=(l,d)=>{let g=this.options,p=u.includes(l.value)||l.group===!0&&this.isGroupSelected(`${l.value}`);return!d&&typeof l.group=="string"&&this.options[this.cursor].value===l.group?s(l,p?"group-active-selected":"group-active",g):d&&p?s(l,"active-selected",g):p?s(l,"selected",g):s(l,d?"active":"inactive",g)};switch(this.state){case"submit":{let l=this.options.filter(({value:g})=>u.includes(g)).map(g=>s(g,"submitted")),d=l.length===0?"":` ${l.join(n("dim",", "))}`;return`${a}${o?n("gray",f):""}${d}`}case"cancel":{let l=this.options.filter(({value:d})=>u.includes(d)).map(d=>s(d,"cancelled")).join(n("dim",", "));return`${a}${o?`${n("gray",f)} `:""}${l.trim()?`${l}${o?`
|
|
57
|
+
${n("gray",f)}`:""}`:""}`}case"error":{let l=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=ue({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,rowPadding:g+p,style:c}).join(`
|
|
62
|
+
${l}`);return`${a}${l}${y}
|
|
63
63
|
${d}
|
|
64
|
-
`}default:{let
|
|
65
|
-
`).length,g=(o?1:0)+1,p=
|
|
66
|
-
${
|
|
64
|
+
`}default:{let l=o?`${n("cyan",f)} `:"",d=a.split(`
|
|
65
|
+
`).length,g=(o?1:0)+1,p=ue({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,rowPadding:d+g,style:c}).join(`
|
|
66
|
+
${l}`);return`${a}${l}${p}
|
|
67
67
|
${o?n("cyan",V):""}
|
|
68
|
-
`}}}}).prompt()},
|
|
69
|
-
`);if(g.length>0){let[p,...y]=g;p.length>0?a.push(`${
|
|
68
|
+
`}}}}).prompt()},I={message:(e=[],{symbol:t=n("gray",f),secondarySymbol:r=n("gray",f),output:s=process.stdout,spacing:i=1,withGuide:o}={})=>{let a=[],u=o??S.withGuide,c=u?r:"",l=u?`${t} `:"",d=u?`${r} `:"";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(`${l}${p}`):a.push(u?t:"");for(let m of y)m.length>0?a.push(`${d}${m}`):a.push(u?r:"")}s.write(`${a.join(`
|
|
70
70
|
`)}
|
|
71
|
-
`)},info:(e,t)=>{
|
|
71
|
+
`)},info:(e,t)=>{I.message(e,{...t,symbol:n("blue",Ft)})},success:(e,t)=>{I.message(e,{...t,symbol:n("green",Mt)})},step:(e,t)=>{I.message(e,{...t,symbol:n("green",ye)})},warn:(e,t)=>{I.message(e,{...t,symbol:n("yellow",Ot)})},warning:(e,t)=>{I.warn(e,t)},error:(e,t)=>{I.message(e,{...t,symbol:n("red",kt)})}},ke=(e="",t)=>{let r=t?.output??process.stdout,s=t?.withGuide??S.withGuide?`${n("gray",V)} `:"";r.write(`${s}${n("red",e)}
|
|
72
72
|
|
|
73
|
-
`)},
|
|
74
|
-
`)},
|
|
75
|
-
${n("gray",V)} `:"";
|
|
73
|
+
`)},Lt=(e="",t)=>{let r=t?.output??process.stdout,s=t?.withGuide??S.withGuide?`${n("gray",Rt)} `:"";r.write(`${s}${e}
|
|
74
|
+
`)},Pt=(e="",t)=>{let r=t?.output??process.stdout,s=t?.withGuide??S.withGuide?`${n("gray",f)}
|
|
75
|
+
${n("gray",V)} `:"";r.write(`${s}${e}
|
|
76
76
|
|
|
77
|
-
`)},
|
|
77
|
+
`)},hi=e=>new qe({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??S.withGuide,r=`${`${t?`${n("gray",f)}
|
|
78
78
|
`:""}${J(this.state)} `}${e.message}
|
|
79
|
-
`,
|
|
80
|
-
${n(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{let
|
|
81
|
-
${
|
|
82
|
-
`}case"submit":{let
|
|
79
|
+
`,s=e.placeholder?n("inverse",e.placeholder[0])+n("dim",e.placeholder.slice(1)):n(["inverse","hidden"],"_"),i=this.userInput?this.userInputWithCursor:s,o=this.value??"",a=e.showSubmit?`
|
|
80
|
+
${n(this.focused==="submit"?"cyan":"dim","[ submit ]")}`:"";switch(this.state){case"error":{let u=`${n("yellow",f)} `,c=t?G(e.output,i,u,void 0):i,l=n("yellow",V);return`${r}${c}
|
|
81
|
+
${l} ${n("yellow",this.error)}${a}
|
|
82
|
+
`}case"submit":{let u=`${n("gray",f)} `,c=t?G(e.output,o,u,void 0,void 0,l=>n("dim",l)):o?n("dim",o):"";return`${r}${c}`}case"cancel":{let u=`${n("gray",f)} `,c=t?G(e.output,o,u,void 0,void 0,l=>n(["strikethrough","dim"],l)):o?n(["strikethrough","dim"],o):"";return`${r}${c}`}default:{let u=t?`${n("cyan",f)} `:"",c=t?n("cyan",V):"",l=t?G(e.output,i,u):i;return`${r}${l}
|
|
83
83
|
${c}${a}
|
|
84
84
|
`}}}}).prompt(),Me=(e,t)=>e.split(`
|
|
85
|
-
`).map(
|
|
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
|
|
85
|
+
`).map(r=>t(r)).join(`
|
|
86
|
+
`),Nt=e=>{let t=(s,i)=>{let o=s.label??String(s.value);return i==="disabled"?`${n("gray",Re)} ${Me(o,a=>n(["strikethrough","gray"],a))}${s.hint?` ${n("dim",`(${s.hint??"disabled"})`)}`:""}`:i==="active"?`${n("cyan",Xe)} ${o}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`:i==="selected"?`${n("green",fe)} ${Me(o,a=>n("dim",a))}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`:i==="cancelled"?`${Me(o,a=>n(["strikethrough","dim"],a))}`:i==="active-selected"?`${n("green",fe)} ${o}${s.hint?` ${n("dim",`(${s.hint})`)}`:""}`:i==="submitted"?`${Me(o,a=>n("dim",a))}`:`${n("dim",Re)} ${Me(o,a=>n("dim",a))}`},r=e.required??!0;return new $r({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,validate(s){if(r&&(s===void 0||s.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 s=e.withGuide??S.withGuide,i=G(e.output,e.message,s?`${Bt(this.state)} `:"",`${J(this.state)} `),o=`${s?`${n("gray",f)}
|
|
88
88
|
`:""}${i}
|
|
89
|
-
`,a=this.value??[],
|
|
90
|
-
${n("gray",f)}`:""}`}case"error":{let c=
|
|
91
|
-
`).map((p,y)=>y===0?`${
|
|
89
|
+
`,a=this.value??[],u=(c,l)=>{if(c.disabled)return t(c,"disabled");let d=a.includes(c.value);return l&&d?t(c,"active-selected"):d?t(c,"selected"):t(c,l?"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"),l=G(e.output,c,s?`${n("gray",f)} `:"");return`${o}${l}`}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 l=G(e.output,c,s?`${n("gray",f)} `:"");return`${o}${l}${s?`
|
|
90
|
+
${n("gray",f)}`:""}`}case"error":{let c=s?`${n("yellow",f)} `:"",l=this.error.split(`
|
|
91
|
+
`).map((p,y)=>y===0?`${s?`${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=l.split(`
|
|
94
|
+
`).length+1;return`${o}${c}${ue({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:d+g,style:u}).join(`
|
|
95
95
|
${c}`)}
|
|
96
|
-
${
|
|
97
|
-
`}default:{let c=
|
|
98
|
-
`).length,d=
|
|
96
|
+
${l}
|
|
97
|
+
`}default:{let c=s?`${n("cyan",f)} `:"",l=o.split(`
|
|
98
|
+
`).length,d=s?2:1;return`${o}${c}${ue({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:c.length,rowPadding:l+d,style:u}).join(`
|
|
99
99
|
${c}`)}
|
|
100
|
-
${
|
|
101
|
-
`}}}}).prompt()},
|
|
102
|
-
`),o=i.reduce((c,
|
|
103
|
-
`).map(o),""],
|
|
100
|
+
${s?n("cyan",V):""}
|
|
101
|
+
`}}}}).prompt()},di=e=>n("dim",e),mi=(e,t,r)=>{let s={hard:!0,trim:!1},i=re(e,t,s).split(`
|
|
102
|
+
`),o=i.reduce((c,l)=>Math.max(j(l),c),0),a=i.map(r).reduce((c,l)=>Math.max(j(l),c),0),u=t-(a-o);return re(e,u,s)},ve=(e="",t="",r)=>{let s=r?.output??Z.stdout,i=r?.withGuide??S.withGuide,o=r?.format??di,a=["",...mi(e,pe(s)-6,o).split(`
|
|
103
|
+
`).map(o),""],u=j(t),c=Math.max(a.reduce((p,y)=>{let m=j(y);return m>p?m:p},0),u)+2,l=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?Ar:At;s.write(`${d}${n("green",ye)} ${n("reset",t)} ${n("gray",Ze.repeat(Math.max(c-u-1,1))+Tt)}
|
|
106
|
+
${l}
|
|
107
|
+
${n("gray",g+Ze.repeat(c+2)+_t)}
|
|
108
|
+
`)},pi=e=>new He({validate:e.validate,mask:e.mask??_r,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??S.withGuide,r=`${t?`${n("gray",f)}
|
|
109
109
|
`:""}${J(this.state)} ${e.message}
|
|
110
|
-
`,
|
|
111
|
-
${o}${
|
|
110
|
+
`,s=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let o=t?`${n("yellow",f)} `:"",a=t?`${n("yellow",V)} `:"",u=i??"";return e.clearOnError&&this.clear(),`${r.trim()}
|
|
111
|
+
${o}${u}
|
|
112
112
|
${a}${n("yellow",this.error)}
|
|
113
|
-
`}case"submit":{let o=t?`${n("gray",f)} `:"",a=i?n("dim",i):"";return`${
|
|
114
|
-
${n("gray",f)}`:""}`}default:{let o=t?`${n("cyan",f)} `:"",a=t?n("cyan",V):"";return`${
|
|
113
|
+
`}case"submit":{let o=t?`${n("gray",f)} `:"",a=i?n("dim",i):"";return`${r}${o}${a}`}case"cancel":{let o=t?`${n("gray",f)} `:"",a=i?n(["strikethrough","dim"],i):"";return`${r}${o}${a}${i&&t?`
|
|
114
|
+
${n("gray",f)}`:""}`}default:{let o=t?`${n("cyan",f)} `:"",a=t?n("cyan",V):"";return`${r}${o}${s}
|
|
115
115
|
${a}
|
|
116
|
-
`}}}}).prompt(),
|
|
117
|
-
`);let
|
|
118
|
-
`);
|
|
119
|
-
`);let k=0,
|
|
120
|
-
`):
|
|
121
|
-
`)),M(),d()};return{start:O,stop:(
|
|
116
|
+
`}}}}).prompt(),gi=e=>{let t=e.validate;return Or({...e,initialUserInput:e.initialValue??e.root??process.cwd(),maxItems:5,validate(r){if(!Array.isArray(r)){if(!r)return"Please select a path";if(t)return t(r)}},options(){let r=this.userInput;if(r==="")return[];try{let s;Js(r)?yr(r).isDirectory()&&(!e.directory||r.endsWith("/"))?s=r:s=vr(r):s=vr(r);let i=r.length>1&&r.endsWith("/")?r.slice(0,-1):r;return Ys(s).map(o=>{let a=Qs(s,o),u=yr(a);return{name:o,path:a,isDirectory:u.isDirectory()}}).filter(({path:o,isDirectory:a})=>o.startsWith(i)&&(a||!e.directory)).map(o=>({value:o.path}))}catch{return[]}}})},fi=e=>n("magenta",e),ae=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:s,errorMessage:i,frames:o=Qe?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:a=Qe?80:120,signal:u,...c}={})=>{let l=St(),d,g,p=!1,y=!1,m="",b,$=performance.now(),v=pe(r),C=c?.styleFrame??fi,R=E=>{let k=E>1?i??S.messages.error:s??S.messages.cancel;y=E===1,p&&(H(k,E),y&&typeof t=="function"&&t())},T=()=>R(2),x=()=>R(1),L=()=>{process.on("uncaughtExceptionMonitor",T),process.on("unhandledRejection",T),process.on("SIGINT",x),process.on("SIGTERM",x),process.on("exit",R),u&&u.addEventListener("abort",x)},M=()=>{process.removeListener("uncaughtExceptionMonitor",T),process.removeListener("unhandledRejection",T),process.removeListener("SIGINT",x),process.removeListener("SIGTERM",x),process.removeListener("exit",R),u&&u.removeEventListener("abort",x)},B=()=>{if(b===void 0)return;l&&r.write(`
|
|
117
|
+
`);let E=re(b,v,{hard:!0,trim:!1}).split(`
|
|
118
|
+
`);E.length>1&&r.write(xe.cursor.up(E.length-1)),r.write(xe.cursor.to(0)),r.write(xe.erase.down())},N=E=>E.replace(/\.+$/,""),W=E=>{let k=(performance.now()-E)/1e3,K=Math.floor(k/60),X=Math.floor(k%60);return K>0?`[${K}m ${X}s]`:`[${X}s]`},w=c.withGuide??S.withGuide,O=(E="")=>{p=!0,d=gr({output:r}),m=N(E),$=performance.now(),w&&r.write(`${n("gray",f)}
|
|
119
|
+
`);let k=0,K=0;L(),g=setInterval(()=>{if(l&&m===b)return;B(),b=m;let X=C(o[k]),ie;if(l)ie=`${X} ${m}...`;else if(e==="timer")ie=`${X} ${m} ${W($)}`;else{let Ce=".".repeat(Math.floor(K)).slice(0,3);ie=`${X} ${m}${Ce}`}let me=re(ie,v,{hard:!0,trim:!1});r.write(me),k=k+1<o.length?k+1:0,K=K<4?K+.125:0},a)},H=(E="",k=0,K=!1)=>{if(!p)return;p=!1,clearInterval(g),B();let X=k===0?n("green",ye):k===1?n("red",Et):n("red",xt);m=E??m,K||(e==="timer"?r.write(`${X} ${m} ${W($)}
|
|
120
|
+
`):r.write(`${X} ${m}
|
|
121
|
+
`)),M(),d()};return{start:O,stop:(E="")=>H(E,0),message:(E="")=>{m=N(E??m)},cancel:(E="")=>H(E,1),error:(E="")=>H(E,2),clear:()=>H("",0,!0),get isCancelled(){return y}}},Ir={light:F("\u2500","-"),heavy:F("\u2501","="),block:F("\u2588","#")};Ye=(e,t)=>e.includes(`
|
|
122
122
|
`)?e.split(`
|
|
123
|
-
`).map(
|
|
124
|
-
`):t(e),q=e=>{let t=(s
|
|
123
|
+
`).map(r=>t(r)).join(`
|
|
124
|
+
`):t(e),q=e=>{let t=(r,s)=>{let i=r.label??String(r.value);switch(s){case"disabled":return`${n("gray",$e)} ${Ye(i,o=>n("gray",o))}${r.hint?` ${n("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${Ye(i,o=>n("dim",o))}`;case"active":return`${n("green",Oe)} ${i}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${Ye(i,o=>n(["strikethrough","dim"],o))}`;default:return`${n("dim",$e)} ${Ye(i,o=>n("dim",o))}`}};return new ze({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??S.withGuide,s=`${J(this.state)} `,i=`${Bt(this.state)} `,o=G(e.output,e.message,i,s),a=`${r?`${n("gray",f)}
|
|
125
125
|
`:""}${o}
|
|
126
|
-
`;switch(this.state){case"submit":{let
|
|
127
|
-
${n("gray",f)}`:""}`}default:{let
|
|
128
|
-
`).length,d=
|
|
129
|
-
${
|
|
126
|
+
`;switch(this.state){case"submit":{let u=r?`${n("gray",f)} `:"",c=G(e.output,t(this.options[this.cursor],"selected"),u);return`${a}${c}`}case"cancel":{let u=r?`${n("gray",f)} `:"",c=G(e.output,t(this.options[this.cursor],"cancelled"),u);return`${a}${c}${r?`
|
|
127
|
+
${n("gray",f)}`:""}`}default:{let u=r?`${n("cyan",f)} `:"",c=r?n("cyan",V):"",l=a.split(`
|
|
128
|
+
`).length,d=r?2:1;return`${a}${u}${ue({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:u.length,rowPadding:l+d,style:(g,p)=>t(g,g.disabled?"disabled":p?"active":"inactive")}).join(`
|
|
129
|
+
${u}`)}
|
|
130
130
|
${c}
|
|
131
|
-
`}}}}).prompt()},
|
|
131
|
+
`}}}}).prompt()},yi=e=>{let t=(r,s="inactive")=>{let i=r.label??String(r.value);return s==="selected"?`${n("dim",i)}`:s==="cancelled"?`${n(["strikethrough","dim"],i)}`:s==="active"?`${n(["bgCyan","gray"],` ${r.value} `)} ${i}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`:`${n(["gray","bgWhite","inverse"],` ${r.value} `)} ${i}${r.hint?` ${n("dim",`(${r.hint})`)}`:""}`};return new Ke({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,caseSensitive:e.caseSensitive,render(){let r=e.withGuide??S.withGuide,s=`${r?`${n("gray",f)}
|
|
132
132
|
`:""}${J(this.state)} ${e.message}
|
|
133
|
-
`;switch(this.state){case"submit":{let i=
|
|
134
|
-
${n("gray",f)}`:""}`}default:{let i=
|
|
135
|
-
`);return`${
|
|
133
|
+
`;switch(this.state){case"submit":{let i=r?`${n("gray",f)} `:"",o=this.options.find(u=>u.value===this.value)??e.options[0],a=G(e.output,t(o,"selected"),i);return`${s}${a}`}case"cancel":{let i=r?`${n("gray",f)} `:"",o=G(e.output,t(this.options[0],"cancelled"),i);return`${s}${o}${r?`
|
|
134
|
+
${n("gray",f)}`:""}`}default:{let i=r?`${n("cyan",f)} `:"",o=r?n("cyan",V):"",a=this.options.map((u,c)=>G(e.output,t(u,c===this.cursor?"active":"inactive"),i)).join(`
|
|
135
|
+
`);return`${s}${a}
|
|
136
136
|
${o}
|
|
137
|
-
`}}}}).prompt()},
|
|
138
|
-
${t} `);let
|
|
139
|
-
${
|
|
140
|
-
`)&&(
|
|
141
|
-
`))).length);let i=
|
|
142
|
-
${
|
|
143
|
-
`)},info:e=>
|
|
144
|
-
`),t.write(`${n("green"
|
|
145
|
-
`);for(let $=0;$<i;$++)t.write(`${
|
|
146
|
-
`);let c=[{value:"",full:""}],
|
|
137
|
+
`}}}}).prompt()},Sr=`${n("gray",f)} `,ge={message:async(e,{symbol:t=n("gray",f)}={})=>{process.stdout.write(`${n("gray",f)}
|
|
138
|
+
${t} `);let r=3;for await(let s of e){s=s.replace(/\n/g,`
|
|
139
|
+
${Sr}`),s.includes(`
|
|
140
|
+
`)&&(r=3+It(s.slice(s.lastIndexOf(`
|
|
141
|
+
`))).length);let i=It(s).length;r+i<process.stdout.columns?(r+=i,process.stdout.write(s)):(process.stdout.write(`
|
|
142
|
+
${Sr}${s.trimStart()}`),r=3+It(s.trimStart()).length)}process.stdout.write(`
|
|
143
|
+
`)},info:e=>ge.message(e,{symbol:n("blue",Ft)}),success:e=>ge.message(e,{symbol:n("green",Mt)}),step:e=>ge.message(e,{symbol:n("green",ye)}),warn:e=>ge.message(e,{symbol:n("yellow",Ot)}),warning:e=>ge.warn(e),error:e=>ge.message(e,{symbol:n("red",kt)})},vi=async(e,t)=>{for(let r of e){if(r.enabled===!1)continue;let s=ae(t);s.start(r.title);let i=await r.task(s.message);s.stop(i||r.title)}},bi=e=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),wi=e=>{let t=e.output??process.stdout,r=pe(t),s=n("gray",f),i=e.spacing??1,o=3,a=e.retainLog===!0,u=!St()&&Er(t);t.write(`${s}
|
|
144
|
+
`),t.write(`${n("green",ye)} ${e.title}
|
|
145
|
+
`);for(let $=0;$<i;$++)t.write(`${s}
|
|
146
|
+
`);let c=[{value:"",full:""}],l=!1,d=$=>{if(c.length===0)return;let v=0;$&&(v+=i+2);for(let C of c){let{value:R,result:T}=C,x=T?.message??R;if(x.length===0)continue;T===void 0&&C.header!==void 0&&C.header!==""&&(x+=`
|
|
147
147
|
${C.header}`);let L=x.split(`
|
|
148
|
-
`).reduce((M,B)=>B===""?M+1:M+Math.ceil((B.length+o)/
|
|
149
|
-
${$.value}`:$.value;$.header!==void 0&&$.header!==""&&
|
|
150
|
-
`).map(T=>n("bold",T)),{output:t,secondarySymbol:
|
|
151
|
-
`).map(T=>n("dim",T)),{output:t,secondarySymbol:
|
|
152
|
-
`),$.value+=
|
|
148
|
+
`).reduce((M,B)=>B===""?M+1:M+Math.ceil((B.length+o)/r),0);v+=L}v>0&&(v+=1,t.write(xe.erase.lines(v)))},g=($,v,C)=>{let R=C?`${$.full}
|
|
149
|
+
${$.value}`:$.value;$.header!==void 0&&$.header!==""&&I.message($.header.split(`
|
|
150
|
+
`).map(T=>n("bold",T)),{output:t,secondarySymbol:s,symbol:s,spacing:0}),I.message(R.split(`
|
|
151
|
+
`).map(T=>n("dim",T)),{output:t,secondarySymbol:s,symbol:s,spacing:v??i})},p=()=>{for(let $ of c){let{header:v,value:C,full:R}=$;(v===void 0||v.length===0)&&C.length===0||g($,void 0,a===!0&&R.length>0)}},y=($,v,C)=>{if(d(!1),(C?.raw!==!0||!l)&&$.value!==""&&($.value+=`
|
|
152
|
+
`),$.value+=bi(v),l=C?.raw===!0,e.limit!==void 0){let R=$.value.split(`
|
|
153
153
|
`),T=R.length-e.limit;if(T>0){let x=R.splice(0,T);a&&($.full+=($.full===""?"":`
|
|
154
154
|
`)+x.join(`
|
|
155
155
|
`))}$.value=R.join(`
|
|
156
|
-
`)}
|
|
156
|
+
`)}u&&m()},m=()=>{for(let $ of c)$.result?$.result.status==="error"?I.error($.result.message,{output:t,secondarySymbol:s,spacing:0}):I.success($.result.message,{output:t,secondarySymbol:s,spacing:0}):$.value!==""&&g($,0)},b=($,v)=>{d(!1),$.result=v,u&&m()};return{message($,v){y(c[0],$,v)},group($){let v={header:$,value:"",full:""};return c.push(v),{message(C,R){y(v,C,R)},error(C){b(v,{status:"error",message:C})},success(C){b(v,{status:"success",message:C})}}},error($,v){d(!0),I.error($,{output:t,secondarySymbol:s,spacing:1}),v?.showLog!==!1&&p(),c.splice(1,c.length-1),c[0].value="",c[0].full=""},success($,v){d(!0),I.success($,{output:t,secondarySymbol:s,spacing:1}),v?.showLog===!0&&p(),c.splice(1,c.length-1),c[0].value="",c[0].full=""}}},he=e=>new Je({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??S.withGuide,r=`${`${t?`${n("gray",f)}
|
|
157
157
|
`:""}${J(this.state)} `}${e.message}
|
|
158
|
-
`,
|
|
159
|
-
${
|
|
158
|
+
`,s=e.placeholder?n("inverse",e.placeholder[0])+n("dim",e.placeholder.slice(1)):n(["inverse","hidden"],"_"),i=this.userInput?this.userInputWithCursor:s,o=this.value??"";switch(this.state){case"error":{let a=this.error?` ${n("yellow",this.error)}`:"",u=t?`${n("yellow",f)} `:"",c=t?n("yellow",V):"";return`${r.trim()}
|
|
159
|
+
${u}${i}
|
|
160
160
|
${c}${a}
|
|
161
|
-
`}case"submit":{let a=o?` ${n("dim",o)}`:"",
|
|
162
|
-
${
|
|
163
|
-
${
|
|
164
|
-
`}}}}).prompt()});Z();Z();import{spawnSync as tr}from"child_process";Z();Z();import{existsSync as ks,readFileSync as bi,writeFileSync as wi,mkdirSync as Ci}from"fs";import Ii from"os";import Bs from"path";var Nt=Bs.join(Ii.homedir(),".eazy-git"),Dt=Bs.join(Nt,"config.json"),Os={language:"es",defaultBaseBranch:"release",aiProvider:"claude"};function Y(){try{if(ks(Dt)){let e=bi(Dt,"utf-8");return{...Os,...JSON.parse(e)}}}catch{}return{...Os}}function Ze(e){let s={...Y(),...e};return ks(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:"Cambiar idioma",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}`,goBack:"Volver"};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:"Change 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}`,goBack:"Go back"};var et={es:Ls,en:Ps};function h(e,...t){let r=Y().language||"es",o=(et[r]||et.es)[e];return typeof o=="function"?o(...t):o||e}function Ns(){let t=Y().language||"es";return(et[t]||et.es).commitTypes}function Ds(){return[{value:"es",label:"Espanol"},{value:"en",label:"English"}]}function A(e){if(Ee(e))return ke(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 Ri=xi(),re=Ri;import Vt from"node:process";import Ti 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,tt;ee("no-color")||ee("no-colors")||ee("color=false")||ee("color=never")?tt=0:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(tt=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&&(tt=r);let i=s?tt: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=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 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
|
|
161
|
+
`}case"submit":{let a=o?` ${n("dim",o)}`:"",u=t?n("gray",f):"";return`${r}${u}${a}`}case"cancel":{let a=o?` ${n(["strikethrough","dim"],o)}`:"",u=t?n("gray",f):"";return`${r}${u}${a}${o.trim()?`
|
|
162
|
+
${u}`:""}`}default:{let a=t?`${n("cyan",f)} `:"",u=t?n("cyan",V):"";return`${r}${a}${i}
|
|
163
|
+
${u}
|
|
164
|
+
`}}}}).prompt()});Y();Y();import{spawnSync as ss}from"child_process";Y();Y();import{existsSync as Lr,readFileSync as Ci,writeFileSync as Ii,mkdirSync as Si}from"fs";import Ei from"os";import Pr from"path";var Dt=Pr.join(Ei.homedir(),".eazy-git"),Vt=Pr.join(Dt,"config.json"),Br={language:"es",defaultBaseBranch:"release",aiProvider:"claude"};function Q(){try{if(Lr(Vt)){let e=Ci(Vt,"utf-8");return{...Br,...JSON.parse(e)}}}catch{}return{...Br}}function et(e){let r={...Q(),...e};return Lr(Dt)||Si(Dt,{recursive:!0}),Ii(Vt,JSON.stringify(r,null,2)),r}var Nr={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",currentVersionLabel:"Version actual",checkingUpdates:"Buscando actualizaciones...",upgradeCheckFailed:"No se pudo verificar la ultima version",alreadyLatest:e=>`Ya tienes la ultima version (${e})`,upgrading:e=>`Actualizando a v${e}...`,upgradeError:"Error al actualizar eazy-git",upgradeSuccess:e=>`eazy-git actualizado a v${e}!`,languageSelect:"Selecciona el idioma de la interfaz:",languageChanged:e=>`Idioma cambiado a: ${e}`,configMenu:"Que deseas configurar?",configLanguage:"Cambiar idioma",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}`,goBack:"Volver"};var Dr={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",currentVersionLabel:"Current version",checkingUpdates:"Checking for updates...",upgradeCheckFailed:"Could not check the latest version",alreadyLatest:e=>`Already on the latest version (${e})`,upgrading:e=>`Upgrading to v${e}...`,upgradeError:"Error upgrading eazy-git",upgradeSuccess:e=>`eazy-git upgraded to v${e}!`,languageSelect:"Select the interface language:",languageChanged:e=>`Language changed to: ${e}`,configMenu:"What would you like to configure?",configLanguage:"Change 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}`,goBack:"Go back"};var tt={es:Nr,en:Dr};function h(e,...t){let s=Q().language||"es",o=(tt[s]||tt.es)[e];return typeof o=="function"?o(...t):o||e}function Vr(){let t=Q().language||"es";return(tt[t]||tt.es).commitTypes}function Ur(){return[{value:"es",label:"Espanol"},{value:"en",label:"English"}]}function A(e){if(Ee(e))return ke(h("operationCancelled")),process.exit(0)}var Gr=(e=0)=>t=>`\x1B[${t+e}m`,jr=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Wr=(e=0)=>(t,r,s)=>`\x1B[${38+e};2;${t};${r};${s}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]}},zn=Object.keys(P.modifier),xi=Object.keys(P.color),Ri=Object.keys(P.bgColor),Kn=[...xi,...Ri];function Ti(){let e=new Map;for(let[t,r]of Object.entries(P)){for(let[s,i]of Object.entries(r))P[s]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[s]=P[s],e.set(i[0],i[1]);Object.defineProperty(P,t,{value:r,enumerable:!1})}return Object.defineProperty(P,"codes",{value:e,enumerable:!1}),P.color.close="\x1B[39m",P.bgColor.close="\x1B[49m",P.color.ansi=Gr(),P.color.ansi256=jr(),P.color.ansi16m=Wr(),P.bgColor.ansi=Gr(10),P.bgColor.ansi256=jr(10),P.bgColor.ansi16m=Wr(10),Object.defineProperties(P,{rgbToAnsi256:{value(t,r,s){return t===r&&r===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[s]=r;s.length===3&&(s=[...s].map(o=>o+o).join(""));let i=Number.parseInt(s,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 r,s,i;if(t>=232)r=((t-232)*10+8)/255,s=r,i=r;else{t-=16;let u=t%36;r=Math.floor(t/36)/5,s=Math.floor(u/6)/5,i=u%6/5}let o=Math.max(r,s,i)*2;if(o===0)return 30;let a=30+(Math.round(i)<<2|Math.round(s)<<1|Math.round(r));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,r,s)=>P.ansi256ToAnsi(P.rgbToAnsi256(t,r,s)),enumerable:!1},hexToAnsi:{value:t=>P.ansi256ToAnsi(P.hexToAnsi256(t)),enumerable:!1}}),P}var _i=Ti(),se=_i;import Ut from"node:process";import Ai from"node:os";import qr from"node:tty";function ee(e,t=globalThis.Deno?globalThis.Deno.args:Ut.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",s=t.indexOf(r+e),i=t.indexOf("--");return s!==-1&&(i===-1||s<i)}var{env:U}=Ut,rt;ee("no-color")||ee("no-colors")||ee("color=false")||ee("color=never")?rt=0:(ee("color")||ee("colors")||ee("color=true")||ee("color=always"))&&(rt=1);function Fi(){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 Mi(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Oi(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let s=Fi();s!==void 0&&(rt=s);let i=r?rt:s;if(i===0)return 0;if(r){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(Ut.platform==="win32"){let a=Ai.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 Hr(e,t={}){let r=Oi(e,{streamIsTTY:e&&e.isTTY,...t});return Mi(r)}var ki={stdout:Hr({isTTY:qr.isatty(1)}),stderr:Hr({isTTY:qr.isatty(2)})},zr=ki;function Kr(e,t,r){let s=e.indexOf(t);if(s===-1)return e;let i=t.length,o=0,a="";do a+=e.slice(o,s)+t+r,o=s+i,s=e.indexOf(t,o);while(s!==-1);return a+=e.slice(o),a}function Jr(e,t,r,s){let i=0,o="";do{let a=e[s-1]==="\r";o+=e.slice(i,a?s-1:s)+t+(a?`\r
|
|
165
165
|
`:`
|
|
166
|
-
`)+
|
|
167
|
-
`,i)}while(
|
|
168
|
-
`);return o!==-1&&(t=
|
|
169
|
-
`):[]}var
|
|
166
|
+
`)+r,i=s+1,s=e.indexOf(`
|
|
167
|
+
`,i)}while(s!==-1);return o+=e.slice(i),o}var{stdout:Yr,stderr:Qr}=zr,Gt=Symbol("GENERATOR"),Te=Symbol("STYLER"),Be=Symbol("IS_EMPTY"),Xr=["ansi","ansi","ansi256","ansi16m"],_e=Object.create(null),Bi=(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 r=Yr?Yr.level:0;e.level=t.level===void 0?r:t.level};var Li=e=>{let t=(...r)=>r.join(" ");return Bi(t,e),Object.setPrototypeOf(t,Le.prototype),t};function Le(e){return Li(e)}Object.setPrototypeOf(Le.prototype,Function.prototype);for(let[e,t]of Object.entries(se))_e[e]={get(){let r=st(this,Wt(t.open,t.close,this[Te]),this[Be]);return Object.defineProperty(this,e,{value:r}),r}};_e.visible={get(){let e=st(this,this[Te],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var jt=(e,t,r,...s)=>e==="rgb"?t==="ansi16m"?se[r].ansi16m(...s):t==="ansi256"?se[r].ansi256(se.rgbToAnsi256(...s)):se[r].ansi(se.rgbToAnsi(...s)):e==="hex"?jt("rgb",t,r,...se.hexToRgb(...s)):se[r][e](...s),Pi=["rgb","hex","ansi256"];for(let e of Pi){_e[e]={get(){let{level:r}=this;return function(...s){let i=Wt(jt(e,Xr[r],"color",...s),se.color.close,this[Te]);return st(this,i,this[Be])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);_e[t]={get(){let{level:r}=this;return function(...s){let i=Wt(jt(e,Xr[r],"bgColor",...s),se.bgColor.close,this[Te]);return st(this,i,this[Be])}}}}var Ni=Object.defineProperties(()=>{},{..._e,level:{enumerable:!0,get(){return this[Gt].level},set(e){this[Gt].level=e}}}),Wt=(e,t,r)=>{let s,i;return r===void 0?(s=e,i=t):(s=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:s,closeAll:i,parent:r}},st=(e,t,r)=>{let s=(...i)=>Di(s,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(s,Ni),s[Gt]=e,s[Te]=t,s[Be]=r,s},Di=(e,t)=>{if(e.level<=0||!t)return e[Be]?"":t;let r=e[Te];if(r===void 0)return t;let{openAll:s,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=Kr(t,r.close,r.open),r=r.parent;let o=t.indexOf(`
|
|
168
|
+
`);return o!==-1&&(t=Jr(t,i,s,o)),s+t+i};Object.defineProperties(Le.prototype,_e);var Vi=Le(),io=Le({level:Qr?Qr.level:0});var be=Vi;var Ae={primary:"#57d7c4",secondary:"#199288",muted:"#9ca3af",success:"#06D6A0",error:"#EF4444",warning:"#F59E0B"},_={primary:e=>be.hex(Ae.primary)(e),secondary:e=>be.hex(Ae.secondary)(e),muted:e=>be.hex(Ae.muted)(e),success:e=>be.hex(Ae.success)(e),error:e=>be.hex(Ae.error)(e),warning:e=>be.hex(Ae.warning)(e)};var Ui=async()=>{let e=await q({message:_.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},Zr=Ui;Y();var Gi=e=>/^[A-Z]{3}-\d{4}$/.test(e),es=Gi;var ji=async()=>{let e=await he({message:_.secondary(h("enterJiraCode")),placeholder:"DPW-0000",initialValue:"",validate(t){if(!t?.trim())return h("jiraRequired");if(!es(t))return h("jiraInvalidFormat")}});return A(e),e},ts=ji;var Wi=async()=>{let e=await Zr(),t=await ts();return`${e}/${t}`},rs=Wi;var qi=async()=>{let e=Q(),t=await rs(),r=ae();try{r.start(h("creatingOriginalBranch")),ss("git",["checkout","-b",t,`origin/${e.defaultBaseBranch}`],{stdio:"inherit"}),ss("git",["push","origin",t],{stdio:"inherit"}),r.stop(h("branchCreatedAndPushed",t)),I.success(h("branchCreatedSuccess",t))}catch(s){r.stop(""),I.error(h("errorCreatingBranch",s.message))}},is=qi;Y();import{spawnSync as Fe}from"child_process";Y();var Hi=async()=>{let e=await q({message:_.secondary(h("mergeBranchQuestion")),options:[{value:"develop",label:h("developDEV")},{value:"release",label:h("releaseUAT")}],required:!0,initialValue:"develop"});return A(e),e},ns=Hi;import{execSync as zi}from"child_process";var Ki=()=>zi("git rev-parse --abbrev-ref HEAD").toString().trim(),os=Ki;var Ji=async()=>{try{let e=await ns(),t=os(),r=`${t}-${e}`;if(Fe("git",["checkout","-b",r,`origin/${e}`],{stdio:"inherit"}),I.success(h("temporalBranchCreated")),Fe("git",["merge",`origin/${t}`],{stdio:"inherit"}),I.success(h("temporalBranchMerged")),Fe("git",["status","--porcelain"],{encoding:"utf-8"}).stdout.includes("UU")){I.warn(h("conflictsDetected"));return}Fe("git",["push","origin",r],{stdio:"inherit"}),I.info(h("branchPushedToRemote"));let i=await le({message:h("removeTemporalBranch")});A(i),i&&(Fe("git",["checkout",t],{stdio:"inherit"}),Fe("git",["branch","-D",r],{stdio:"inherit"}),I.info(h("temporalBranchDeleted")))}catch(e){I.error(`${h("errorCreatingTemporal")}: ${e.message}`)}},as=Ji;Y();import{execSync as we,spawnSync as te,spawn as Yi}from"child_process";function cs(e){let t=e.match(/^[MADRCU? ]{2}\s+(.+)$/),r=t?t[1]:e.replace(/^[MADRCU? ]+\s+/,"");return r.includes(" -> ")?r.split(" -> ")[1].trim():r.trim()}function us(){let e=we("git status --short",{encoding:"utf-8"}).trim();return e?e.split(`
|
|
169
|
+
`):[]}var Qi=async()=>{let e=Q(),t=Vr(),r=Object.entries(t).map(([w,O])=>({value:w,label:O})),s={M:h("statusModified"),A:h("statusAdded"),D:h("statusDeleted"),R:h("statusRenamed"),"??":h("statusUntracked")},i=we("git rev-parse --abbrev-ref HEAD",{encoding:"utf-8"}).trim(),o=us();if(I.info(`${h("currentBranch")}: ${i}`),I.info(`${h("filesChanged")}: ${o.length}`),o.length===0){let w=await le({message:h("noChangesPending")});if(A(w),!w)return}let a=ae();a.start(h("updatingRefs"));try{we("git fetch --quiet"),a.stop(h("refsUpdated"))}catch{a.stop(h("fetchFailed"))}let u=await he({message:_.secondary(h("baseBranch")),placeholder:e.defaultBaseBranch,initialValue:e.defaultBaseBranch,validate:w=>w?.trim()?void 0:h("baseBranchRequired")});A(u);let c=await he({message:_.secondary(h("ticketId")),placeholder:"DPW-0000",validate:w=>w?.trim()?void 0:h("ticketRequired")});A(c);let l=await q({message:_.secondary(h("changeType")),options:r});A(l);let d=`${l}/${c}`;if(te("git",["branch","--list",d],{encoding:"utf-8"}).stdout.trim()){let w=await q({message:_.secondary(h("branchExistsLocal",d)),options:[{value:"checkout",label:h("switchToIt")},{value:"cancel",label:h("cancel")}]});if(A(w),w==="cancel"){I.warn(h("cancelledOp"));return}te("git",["checkout",d],{stdio:"inherit"})}else try{a.start(h("creatingBranch",d,u)),te("git",["checkout","-b",d,`origin/${u}`],{stdio:"pipe"}),a.stop(h("branchCreated",d))}catch(w){a.stop(""),I.error(h("errorCreatingBranch",w.message));return}let p=!1;for(;!p;){let w=us();if(w.length===0){I.warn(h("noFilesToStage"));return}let O="__select_all__",H=w.map(ie=>{let me=ie.slice(0,2).trim(),Ce=cs(ie),ms=s[me]??me;return{value:ie,label:Ce,hint:ms}}),E=await Nt({message:_.secondary(h("selectFiles")),options:[{value:O,label:_.primary(h("selectAllFiles"))},...H],required:!0});A(E);let k=E.includes(O)?w:E;te("git",["restore","--staged","."],{encoding:"utf-8"});for(let ie of k){let me=cs(ie),Ce=te("git",["add","--",me],{encoding:"utf-8"});Ce.status!==0&&I.error(`git add failed for ${me}: ${Ce.stderr}`)}let K=we("git status --short",{encoding:"utf-8"}).trim();ve(K,h("stagedFiles"));let X=await le({message:h("stagedCorrect")});A(X),p=X,p||te("git",["restore","--staged","."],{encoding:"utf-8"})}let y=we("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: ${l}(${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 q({message:_.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:R}=$[b];a.start(h("generatingCommit",R));let T=await new Promise(w=>{let O="",H="",
|
|
181
|
-
`).filter(Boolean).length,W=[`${h("summaryBranch")}: ${d}`,`${h("summaryFrom")}: origin/${
|
|
182
|
-
`),h("summaryTitle"))},
|
|
183
|
-
`);
|
|
180
|
+
${y}`,b=await q({message:_.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:R}=$[b];a.start(h("generatingCommit",R));let T=await new Promise(w=>{let O="",H="",E=Yi(v,C,{stdio:["ignore","pipe","pipe"]});E.stdout.on("data",k=>{O+=k}),E.stderr.on("data",k=>{H+=k}),E.on("close",k=>w({status:k,stdout:O,stderr:H,error:null})),E.on("error",k=>w({status:1,stdout:"",stderr:"",error:k}))});a.stop("");let x;if(T.error||T.status!==0){I.warn(h("aiSuggestionFailed",R));let w=await he({message:_.secondary(h("writeCommitMsg")),initialValue:`${l}(${c}): `,validate:O=>O?.trim()?void 0:h("commitMsgRequired")});A(w),x=w}else{let w=T.stdout.trim();ve(w,h("suggestionOf",R));let O=await q({message:_.secondary(h("useThisCommit")),options:[{value:"yes",label:h("yesUseIt")},{value:"modify",label:h("modify")}]});if(A(O),O==="yes")x=w;else{let H=await he({message:_.secondary(h("writeCommitMsg")),initialValue:w,validate:E=>E?.trim()?void 0:h("commitMsgRequired")});A(H),x=H}}let L=!1;for(;!L;)if(te("git",["commit","-m",x],{stdio:"inherit"}).status===0)I.success(h("commitSuccess")),L=!0;else{let O=await q({message:_.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"}),I.success(h("commitNoHooks")),L=!0),O==="retry"&&te("git",["add","-u"],{stdio:"inherit"})}let M=await le({message:h("pushToRemote")});A(M);let B="";if(M){let w=(E=!1)=>{te("git",E?["push","-f","origin",d]:["push","-u","origin",d],{stdio:"inherit"})},O=()=>{let E=we("git remote get-url origin",{encoding:"utf-8"}).trim(),k=E.match(/[:/]([^/]+\/[^/]+?)(\.git)?$/),K=k?k[1]:"";return E.includes("github.com")?`https://github.com/${K}/compare/${d}?expand=1`:E.includes("bitbucket.org")?`https://bitbucket.org/${K}/pull-requests/new?source=${d}`:E.includes("gitlab.com")?`https://gitlab.com/${K}/-/merge_requests/new?merge_request[source_branch]=${d}`:""};if(te("git",["push","-u","origin",d],{stdio:"inherit"}).status===0)I.success(h("pushSuccess")),B=O();else{let E=await le({message:h("pushForceQuestion")});A(E),E&&(te("git",["push","-f","origin",d],{stdio:"inherit"}).status===0?(I.success(h("pushForceSuccess")),B=O()):I.error(h("pushForceError","push failed")))}}let N=we('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/${u}`,`${h("summaryCommit")}: ${x}`,`${h("summaryFiles",N)}`,...M&&B?[`${h("summaryPush")}: origin/${d}`,`${h("summaryPR")}: ${B}`]:[]];ve(W.join(`
|
|
182
|
+
`),h("summaryTitle"))},ls=Qi;Y();async function de(){let e=await q({message:_.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 q({message:_.secondary(h("languageSelect")),options:Ur(),initialValue:Q().language});return A(t),et({language:t}),I.success(h("languageChanged",t)),de()}if(e==="defaultBranch"){let{text:t}=await Promise.resolve().then(()=>(Y(),kr)),r=await t({message:_.secondary(h("baseBranch")),initialValue:Q().defaultBaseBranch,validate:s=>s?.trim()?void 0:h("baseBranchRequired")});return A(r),et({defaultBaseBranch:r}),I.success(h("defaultBranchSet",r)),de()}if(e==="aiProvider"){let t=await q({message:_.secondary(h("aiProvider")),options:[{value:"claude",label:"Claude"},{value:"opencode",label:"Opencode"}],initialValue:Q().aiProvider});return A(t),et({aiProvider:t}),I.success(h("aiProviderSet",t)),de()}if(e==="view"){let t=Q(),r=Object.entries(t).map(([i,o])=>` ${i}: ${o}`).join(`
|
|
183
|
+
`);ve(r,_.secondary(h("currentConfig")));let s=await q({message:_.secondary(""),options:[{value:"back",label:_.muted(h("goBack"))}]});return A(s),de()}}Y();import{spawnSync as hs}from"child_process";import{readFileSync as Xi}from"fs";import{fileURLToPath as Zi}from"url";import{dirname as en,resolve as tn}from"path";var rn=()=>{let e=Zi(import.meta.url),t=en(e);return JSON.parse(Xi(tn(t,"../package.json"),"utf8"))?.version},it=rn;async function qt(){let e=it();I.info(`${h("currentVersionLabel")}: ${_.muted(e)}`);let t=ae();t.start(h("checkingUpdates"));let r=hs("npm",["view","eazy-git","version"],{encoding:"utf-8"}),s=r.stdout?.trim();if(r.status!==0||!s){t.stop(h("upgradeCheckFailed"));return}if(e===s){t.stop(h("alreadyLatest",s));return}t.message(h("upgrading",s));let i=hs("npm",["install","-g","eazy-git@latest"],{encoding:"utf-8",stdio:"pipe"});if(i.status!==0){t.stop(h("upgradeError")),I.error(i.stderr?.trim()||h("unexpectedError"));return}t.stop(h("upgradeSuccess",s))}Y();import{existsSync as sn}from"fs";import{join as nn}from"path";import{execSync as on}from"child_process";var an=()=>{try{on("git --version",{stdio:"ignore"})}catch{I.error(h("gitNotInstalled")),process.exit(1)}let e=nn(process.cwd(),".git");sn(e)||(I.error(h("notGitRepo")),process.exit(1))},ds=an;var Pe=process.argv.slice(2);(Pe.includes("-v")||Pe.includes("--version"))&&(console.log(`${h("version")}: ${it()}`),process.exit(0));(Pe.includes("config")||Pe.includes("--config"))&&(await de(),process.exit(0));Pe.includes("upgrade")&&(await qt(),process.exit(0));ds();Lt(_.primary(`
|
|
184
184
|
${h("welcome")}
|
|
185
185
|
|
|
186
186
|
.-------------------------------------------------------------------------------.
|
|
@@ -195,4 +195,4 @@ ${y}`,b=await q({message:_.secondary(h("aiProvider")),options:[{value:"claude",l
|
|
|
195
195
|
'-------------------------------------------------------------------------------'
|
|
196
196
|
|
|
197
197
|
${_.muted(h("subtitle"))}
|
|
198
|
-
`));var
|
|
198
|
+
`));var nt=await q({message:_.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"});nt==="ACB"?await ls():nt==="CRO"?await is():nt==="CRT"?await as():nt==="CFG"?await de():(ke(h("operationCancelled")),process.exit(0));Pt(_.success(h("operationCompleted")));
|