@gilbert_oliveira/commit-wizard 2.0.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/dist/commit-wizard.d.ts +1 -0
- package/dist/commit-wizard.js +52 -110
- package/package.json +48 -35
- package/{bin → src/bin}/commit-wizard.ts +6 -5
- package/src/config/index.ts +2 -3
- package/src/core/cache.ts +2 -2
- package/src/core/index.ts +10 -10
- package/src/core/openai.ts +1 -1
- package/src/core/smart-split.ts +16 -16
- package/src/ui/index.ts +1 -1
- package/src/ui/smart-split.ts +1 -1
- package/src/utils/polyfill.ts +0 -86
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@gilbert_oliveira/commit-wizard)
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
|
|
12
|
-
Um CLI desenvolvido
|
|
12
|
+
Um CLI desenvolvido para Node.js que analisa suas mudanças no Git e gera mensagens de commit personalizadas usando a API da OpenAI.
|
|
13
13
|
|
|
14
14
|
## 📊 Status do Projeto
|
|
15
15
|
|
|
@@ -60,13 +60,13 @@ Um CLI desenvolvido com Bun.js que analisa suas mudanças no Git e gera mensagen
|
|
|
60
60
|
|
|
61
61
|
### Pré-requisitos
|
|
62
62
|
|
|
63
|
-
-
|
|
63
|
+
- Node.js 18+ instalado
|
|
64
64
|
- Chave da API OpenAI
|
|
65
65
|
|
|
66
66
|
### Instalação Global
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
|
|
69
|
+
npm install -g @gilbert_oliveira/commit-wizard
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
### Uso via npx (sem instalação)
|
|
@@ -358,9 +358,7 @@ commit-wizard --split
|
|
|
358
358
|
### Executar Testes
|
|
359
359
|
|
|
360
360
|
```bash
|
|
361
|
-
|
|
362
|
-
bun test src/__tests__ # Testes unitários
|
|
363
|
-
bun test tests/ # Testes de integração
|
|
361
|
+
npm run test # Todos os testes
|
|
364
362
|
```
|
|
365
363
|
|
|
366
364
|
### Desenvolvimento Local
|
|
@@ -368,14 +366,15 @@ bun test tests/ # Testes de integração
|
|
|
368
366
|
```bash
|
|
369
367
|
git clone https://github.com/gilbert-oliveira/commit-wizard
|
|
370
368
|
cd commit-wizard
|
|
371
|
-
|
|
372
|
-
|
|
369
|
+
|
|
370
|
+
npm install
|
|
371
|
+
npm run dev
|
|
373
372
|
```
|
|
374
373
|
|
|
375
374
|
### Build
|
|
376
375
|
|
|
377
376
|
```bash
|
|
378
|
-
|
|
377
|
+
npm run build
|
|
379
378
|
```
|
|
380
379
|
|
|
381
380
|
---
|
|
@@ -437,7 +436,7 @@ MIT © [Gilbert Oliveira](https://github.com/gilbert-oliveira)
|
|
|
437
436
|
|
|
438
437
|
- [Documentação da OpenAI](https://platform.openai.com/docs)
|
|
439
438
|
- [Conventional Commits](https://www.conventionalcommits.org/)
|
|
440
|
-
- [
|
|
439
|
+
- [Node.js](https://nodejs.org/) (alternativa)
|
|
441
440
|
- [📋 Guia para Contribuidores](.github/README.md) - Informações sobre desenvolvimento e CI/CD
|
|
442
441
|
|
|
443
442
|
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/commit-wizard.js
CHANGED
|
@@ -1,71 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`).split(
|
|
5
|
-
|
|
6
|
-
`)}function RI(b,I){if(typeof b=="string")return S1.aliases.get(b)===I;for(let $ of b)if($!==void 0&&RI($,I))return!0;return!1}function N4(b,I){if(b===I)return;let $=b.split(`
|
|
7
|
-
`),H=I.split(`
|
|
8
|
-
`),Y=[];for(let X=0;X<Math.max($.length,H.length);X++)$[X]!==H[X]&&Y.push(X);return Y}function P(b){return b===s1}function j1(b,I){let $=b;$.isTTY&&$.setRawMode(I)}class L1{constructor(b,I=!0){E(this,"input"),E(this,"output"),E(this,"_abortSignal"),E(this,"rl"),E(this,"opts"),E(this,"_render"),E(this,"_track",!1),E(this,"_prevFrame",""),E(this,"_subscribers",new Map),E(this,"_cursor",0),E(this,"state","initial"),E(this,"error",""),E(this,"value");let{input:$=t9,output:H=o9,render:Y,signal:X,...G}=b;this.opts=G,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=I,this._abortSignal=X,this.input=$,this.output=H}unsubscribe(){this._subscribers.clear()}setSubscriber(b,I){let $=this._subscribers.get(b)??[];$.push(I),this._subscribers.set(b,$)}on(b,I){this.setSubscriber(b,{cb:I})}once(b,I){this.setSubscriber(b,{cb:I,once:!0})}emit(b,...I){let $=this._subscribers.get(b)??[],H=[];for(let Y of $)Y.cb(...I),Y.once&&H.push(()=>$.splice($.indexOf(Y),1));for(let Y of H)Y()}prompt(){return new Promise((b,I)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),b(s1);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let $=new s9;$._write=(H,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe($),this.rl=VI.createInterface({input:this.input,output:$,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),VI.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),j1(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(y.cursor.show),this.output.off("resize",this.render),j1(this.input,!1),b(this.value)}),this.once("cancel",()=>{this.output.write(y.cursor.show),this.output.off("resize",this.render),j1(this.input,!1),b(s1)})})}onKeypress(b,I){if(this.state==="error"&&(this.state="active"),I?.name&&(!this._track&&S1.aliases.has(I.name)&&this.emit("cursor",S1.aliases.get(I.name)),S1.actions.has(I.name)&&this.emit("cursor",I.name)),b&&(b.toLowerCase()==="y"||b.toLowerCase()==="n")&&this.emit("confirm",b.toLowerCase()==="y"),b==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),b&&this.emit("key",b.toLowerCase()),I?.name==="return"){if(this.opts.validate){let $=this.opts.validate(this.value);$&&(this.error=$ instanceof Error?$.message:$,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}RI([b,I?.name,I?.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(`
|
|
9
|
-
`),j1(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let b=SI(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
10
|
-
`).length-1;this.output.write(y.cursor.move(-999,b*-1))}render(){let b=SI(this._render(this)??"",process.stdout.columns,{hard:!0});if(b!==this._prevFrame){if(this.state==="initial")this.output.write(y.cursor.hide);else{let I=N4(this._prevFrame,b);if(this.restoreCursor(),I&&I?.length===1){let $=I[0];this.output.write(y.cursor.move(0,$)),this.output.write(y.erase.lines(1));let H=b.split(`
|
|
11
|
-
`);this.output.write(H[$]),this._prevFrame=b,this.output.write(y.cursor.move(0,H.length-$-1));return}if(I&&I?.length>1){let $=I[0];this.output.write(y.cursor.move(0,$)),this.output.write(y.erase.down());let H=b.split(`
|
|
12
|
-
`).slice($);this.output.write(H.join(`
|
|
13
|
-
`)),this._prevFrame=b;return}this.output.write(y.erase.down())}this.output.write(b),this.state==="initial"&&(this.state="active"),this._prevFrame=b}}}var y,LI,b4,MI,I4,G4,$4=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},H4,t1=10,WI=(b=0)=>(I)=>`\x1B[${I+b}m`,zI=(b=0)=>(I)=>`\x1B[${38+b};5;${I}m`,NI=(b=0)=>(I,$,H)=>`\x1B[${38+b};2;${I};${$};${H}m`,L,Y4,X4,J4,T1,q4=39,e1="\x07",OI="[",Q4="]",AI="m",bb,KI=(b)=>`${T1.values().next().value}${OI}${b}${AI}`,jI=(b)=>`${T1.values().next().value}${bb}${b}${e1}`,U4=(b)=>b.split(" ").map((I)=>I1(I)),o1=(b,I,$)=>{let H=[...I],Y=!1,X=!1,G=I1(BI(b[b.length-1]));for(let[Z,J]of H.entries()){let q=I1(J);if(G+q<=$?b[b.length-1]+=J:(b.push(J),G=0),T1.has(J)&&(Y=!0,X=H.slice(Z+1).join("").startsWith(bb)),Y){X?J===e1&&(Y=!1,X=!1):J===AI&&(Y=!1);continue}G+=q,G===$&&Z<H.length-1&&(b.push(""),G=0)}!G&&b[b.length-1].length>0&&b.length>1&&(b[b.length-2]+=b.pop())},V4=(b)=>{let I=b.split(" "),$=I.length;for(;$>0&&!(I1(I[$-1])>0);)$--;return $===I.length?b:I.slice(0,$).join(" ")+I.slice($).join("")},W4=(b,I,$={})=>{if($.trim!==!1&&b.trim()==="")return"";let H="",Y,X,G=U4(b),Z=[""];for(let[q,Q]of b.split(" ").entries()){$.trim!==!1&&(Z[Z.length-1]=Z[Z.length-1].trimStart());let W=I1(Z[Z.length-1]);if(q!==0&&(W>=I&&($.wordWrap===!1||$.trim===!1)&&(Z.push(""),W=0),(W>0||$.trim===!1)&&(Z[Z.length-1]+=" ",W++)),$.hard&&G[q]>I){let z=I-W,K=1+Math.floor((G[q]-z-1)/I);Math.floor((G[q]-1)/I)<K&&Z.push(""),o1(Z,Q,I);continue}if(W+G[q]>I&&W>0&&G[q]>0){if($.wordWrap===!1&&W<I){o1(Z,Q,I);continue}Z.push("")}if(W+G[q]>I&&$.wordWrap===!1){o1(Z,Q,I);continue}Z[Z.length-1]+=Q}$.trim!==!1&&(Z=Z.map((q)=>V4(q)));let J=[...Z.join(`
|
|
14
|
-
`)];for(let[q,Q]of J.entries()){if(H+=Q,T1.has(Q)){let{groups:z}=new RegExp(`(?:\\${OI}(?<code>\\d+)m|\\${bb}(?<uri>.*)${e1})`).exec(J.slice(q).join(""))||{groups:{}};if(z.code!==void 0){let K=Number.parseFloat(z.code);Y=K===q4?void 0:K}else z.uri!==void 0&&(X=z.uri.length===0?void 0:z.uri)}let W=J4.codes.get(Number(Y));J[q+1]===`
|
|
15
|
-
`?(X&&(H+=jI("")),Y&&W&&(H+=KI(W))):Q===`
|
|
16
|
-
`&&(Y&&W&&(H+=KI(Y)),X&&(H+=jI(X)))}return H},z4,S1,D$,s1,K4,j4=(b,I,$)=>(I in b)?K4(b,I,{enumerable:!0,configurable:!0,writable:!0,value:$}):b[I]=$,E=(b,I,$)=>(j4(b,typeof I!="symbol"?I+"":I,$),$),Ib,S4,T4,L4=(b,I,$)=>(I in b)?T4(b,I,{enumerable:!0,configurable:!0,writable:!0,value:$}):b[I]=$,TI=(b,I,$)=>(L4(b,typeof I!="symbol"?I+"":I,$),$),Gb,$b;var Hb=N(()=>{y=F(a1(),1),LI=F(r1(),1);b4=e9();MI={exports:{}};(function(b){var I={};b.exports=I,I.eastAsianWidth=function(H){var Y=H.charCodeAt(0),X=H.length==2?H.charCodeAt(1):0,G=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,G=Y<<10|X,G+=65536),G==12288||65281<=G&&G<=65376||65504<=G&&G<=65510?"F":G==8361||65377<=G&&G<=65470||65474<=G&&G<=65479||65482<=G&&G<=65487||65490<=G&&G<=65495||65498<=G&&G<=65500||65512<=G&&G<=65518?"H":4352<=G&&G<=4447||4515<=G&&G<=4519||4602<=G&&G<=4607||9001<=G&&G<=9002||11904<=G&&G<=11929||11931<=G&&G<=12019||12032<=G&&G<=12245||12272<=G&&G<=12283||12289<=G&&G<=12350||12353<=G&&G<=12438||12441<=G&&G<=12543||12549<=G&&G<=12589||12593<=G&&G<=12686||12688<=G&&G<=12730||12736<=G&&G<=12771||12784<=G&&G<=12830||12832<=G&&G<=12871||12880<=G&&G<=13054||13056<=G&&G<=19903||19968<=G&&G<=42124||42128<=G&&G<=42182||43360<=G&&G<=43388||44032<=G&&G<=55203||55216<=G&&G<=55238||55243<=G&&G<=55291||63744<=G&&G<=64255||65040<=G&&G<=65049||65072<=G&&G<=65106||65108<=G&&G<=65126||65128<=G&&G<=65131||110592<=G&&G<=110593||127488<=G&&G<=127490||127504<=G&&G<=127546||127552<=G&&G<=127560||127568<=G&&G<=127569||131072<=G&&G<=194367||177984<=G&&G<=196605||196608<=G&&G<=262141?"W":32<=G&&G<=126||162<=G&&G<=163||165<=G&&G<=166||G==172||G==175||10214<=G&&G<=10221||10629<=G&&G<=10630?"Na":G==161||G==164||167<=G&&G<=168||G==170||173<=G&&G<=174||176<=G&&G<=180||182<=G&&G<=186||188<=G&&G<=191||G==198||G==208||215<=G&&G<=216||222<=G&&G<=225||G==230||232<=G&&G<=234||236<=G&&G<=237||G==240||242<=G&&G<=243||247<=G&&G<=250||G==252||G==254||G==257||G==273||G==275||G==283||294<=G&&G<=295||G==299||305<=G&&G<=307||G==312||319<=G&&G<=322||G==324||328<=G&&G<=331||G==333||338<=G&&G<=339||358<=G&&G<=359||G==363||G==462||G==464||G==466||G==468||G==470||G==472||G==474||G==476||G==593||G==609||G==708||G==711||713<=G&&G<=715||G==717||G==720||728<=G&&G<=731||G==733||G==735||768<=G&&G<=879||913<=G&&G<=929||931<=G&&G<=937||945<=G&&G<=961||963<=G&&G<=969||G==1025||1040<=G&&G<=1103||G==1105||G==8208||8211<=G&&G<=8214||8216<=G&&G<=8217||8220<=G&&G<=8221||8224<=G&&G<=8226||8228<=G&&G<=8231||G==8240||8242<=G&&G<=8243||G==8245||G==8251||G==8254||G==8308||G==8319||8321<=G&&G<=8324||G==8364||G==8451||G==8453||G==8457||G==8467||G==8470||8481<=G&&G<=8482||G==8486||G==8491||8531<=G&&G<=8532||8539<=G&&G<=8542||8544<=G&&G<=8555||8560<=G&&G<=8569||G==8585||8592<=G&&G<=8601||8632<=G&&G<=8633||G==8658||G==8660||G==8679||G==8704||8706<=G&&G<=8707||8711<=G&&G<=8712||G==8715||G==8719||G==8721||G==8725||G==8730||8733<=G&&G<=8736||G==8739||G==8741||8743<=G&&G<=8748||G==8750||8756<=G&&G<=8759||8764<=G&&G<=8765||G==8776||G==8780||G==8786||8800<=G&&G<=8801||8804<=G&&G<=8807||8810<=G&&G<=8811||8814<=G&&G<=8815||8834<=G&&G<=8835||8838<=G&&G<=8839||G==8853||G==8857||G==8869||G==8895||G==8978||9312<=G&&G<=9449||9451<=G&&G<=9547||9552<=G&&G<=9587||9600<=G&&G<=9615||9618<=G&&G<=9621||9632<=G&&G<=9633||9635<=G&&G<=9641||9650<=G&&G<=9651||9654<=G&&G<=9655||9660<=G&&G<=9661||9664<=G&&G<=9665||9670<=G&&G<=9672||G==9675||9678<=G&&G<=9681||9698<=G&&G<=9701||G==9711||9733<=G&&G<=9734||G==9737||9742<=G&&G<=9743||9748<=G&&G<=9749||G==9756||G==9758||G==9792||G==9794||9824<=G&&G<=9825||9827<=G&&G<=9829||9831<=G&&G<=9834||9836<=G&&G<=9837||G==9839||9886<=G&&G<=9887||9918<=G&&G<=9919||9924<=G&&G<=9933||9935<=G&&G<=9953||G==9955||9960<=G&&G<=9983||G==10045||G==10071||10102<=G&&G<=10111||11093<=G&&G<=11097||12872<=G&&G<=12879||57344<=G&&G<=63743||65024<=G&&G<=65039||G==65533||127232<=G&&G<=127242||127248<=G&&G<=127277||127280<=G&&G<=127337||127344<=G&&G<=127386||917760<=G&&G<=917999||983040<=G&&G<=1048573||1048576<=G&&G<=1114109?"A":"N"},I.characterLength=function(H){var Y=this.eastAsianWidth(H);return Y=="F"||Y=="W"||Y=="A"?2:1};function $(H){return H.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}I.length=function(H){for(var Y=$(H),X=0,G=0;G<Y.length;G++)X=X+this.characterLength(Y[G]);return X},I.slice=function(H,Y,X){textLen=I.length(H),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var G="",Z=0,J=$(H),q=0;q<J.length;q++){var Q=J[q],W=I.length(Q);if(Z>=Y-(W==2?1:0))if(Z+W<=X)G+=Q;else break;Z+=W}return G}})(MI);I4=MI.exports,G4=_I(I4),H4=_I($4);L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(L.modifier);Y4=Object.keys(L.color),X4=Object.keys(L.bgColor);[...Y4];J4=Z4(),T1=new Set(["\x1B","\x9B"]),bb=`${Q4}8;;`;z4=["up","down","left","right","space","enter","cancel"],S1={actions:new Set(z4),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};D$=globalThis.process.platform.startsWith("win"),s1=Symbol("clack:cancel");K4=Object.defineProperty;Ib=class Ib extends L1{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(b){super(b,!1),this.value=!!b.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(I)=>{this.output.write(y.cursor.move(0,-1)),this.value=I,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};S4=new WeakMap;T4=Object.defineProperty;Gb=class Gb extends L1{constructor(b){super(b,!1),TI(this,"options"),TI(this,"cursor",0),this.options=b.options,this.cursor=this.options.findIndex(({value:I})=>I===b.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(I)=>{switch(I){case"left":case"up":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;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};$b=class $b extends L1{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let b=this.value.slice(0,this.cursor),[I,...$]=this.value.slice(this.cursor);return`${b}${LI.default.inverse(I)}${$.join("")}`}get cursor(){return this._cursor}constructor(b){super(b),this.on("finalize",()=>{this.value||(this.value=b.defaultValue)})}}});import{stripVTControlCharacters as Yb}from"util";import v from"process";function B4(){return v.platform!=="win32"?v.env.TERM!=="linux":!!v.env.CI||!!v.env.WT_SESSION||!!v.env.TERMINUS_SUBLIME||v.env.ConEmuTask==="{cmd::Cmder}"||v.env.TERM_PROGRAM==="Terminus-Sublime"||v.env.TERM_PROGRAM==="vscode"||v.env.TERM==="xterm-256color"||v.env.TERM==="alacritty"||v.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var U,yI,_4,B=(b,I)=>_4?b:I,M4,O4,A4,Jb,R4,T,a,Xb,Zb,r$,t$,o$,s$,EI,E4,y4,P4,w4,x4,k4,F4,qb=(b)=>{switch(b){case"initial":case"active":return U.default.cyan(M4);case"cancel":return U.default.red(O4);case"error":return U.default.yellow(A4);case"submit":return U.default.green(Jb)}},v4=(b)=>{let{cursor:I,options:$,style:H}=b,Y=b.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),G=Math.min(X,Math.max(Y,5)),Z=0;I>=Z+G-3?Z=Math.max(Math.min(I-G+3,$.length-G),0):I<Z+2&&(Z=Math.max(I-2,0));let J=G<$.length&&Z>0,q=G<$.length&&Z+G<$.length;return $.slice(Z,Z+G).map((Q,W,z)=>{let K=W===0&&J,S=W===z.length-1&&q;return K||S?U.default.dim("..."):H(Q,W+Z===I)})},PI=(b)=>new $b({validate:b.validate,placeholder:b.placeholder,defaultValue:b.defaultValue,initialValue:b.initialValue,render(){let I=`${U.default.gray(T)}
|
|
17
|
-
${qb(this.state)} ${b.message}
|
|
18
|
-
`,$=b.placeholder?U.default.inverse(b.placeholder[0])+U.default.dim(b.placeholder.slice(1)):U.default.inverse(U.default.hidden("_")),H=this.value?this.valueWithCursor:$;switch(this.state){case"error":return`${I.trim()}
|
|
19
|
-
${U.default.yellow(T)} ${H}
|
|
20
|
-
${U.default.yellow(a)} ${U.default.yellow(this.error)}
|
|
21
|
-
`;case"submit":return`${I}${U.default.gray(T)} ${U.default.dim(this.value||b.placeholder)}`;case"cancel":return`${I}${U.default.gray(T)} ${U.default.strikethrough(U.default.dim(this.value??""))}${this.value?.trim()?`
|
|
22
|
-
${U.default.gray(T)}`:""}`;default:return`${I}${U.default.cyan(T)} ${H}
|
|
23
|
-
${U.default.cyan(a)}
|
|
24
|
-
`}}}).prompt(),g=(b)=>{let I=b.active??"Yes",$=b.inactive??"No";return new Ib({active:I,inactive:$,initialValue:b.initialValue??!0,render(){let H=`${U.default.gray(T)}
|
|
25
|
-
${qb(this.state)} ${b.message}
|
|
26
|
-
`,Y=this.value?I:$;switch(this.state){case"submit":return`${H}${U.default.gray(T)} ${U.default.dim(Y)}`;case"cancel":return`${H}${U.default.gray(T)} ${U.default.strikethrough(U.default.dim(Y))}
|
|
27
|
-
${U.default.gray(T)}`;default:return`${H}${U.default.cyan(T)} ${this.value?`${U.default.green(Xb)} ${I}`:`${U.default.dim(Zb)} ${U.default.dim(I)}`} ${U.default.dim("/")} ${this.value?`${U.default.dim(Zb)} ${U.default.dim($)}`:`${U.default.green(Xb)} ${$}`}
|
|
28
|
-
${U.default.cyan(a)}
|
|
29
|
-
`}}}).prompt()},G1=(b)=>{let I=($,H)=>{let Y=$.label??String($.value);switch(H){case"selected":return`${U.default.dim(Y)}`;case"active":return`${U.default.green(Xb)} ${Y} ${$.hint?U.default.dim(`(${$.hint})`):""}`;case"cancelled":return`${U.default.strikethrough(U.default.dim(Y))}`;default:return`${U.default.dim(Zb)} ${U.default.dim(Y)}`}};return new Gb({options:b.options,initialValue:b.initialValue,render(){let $=`${U.default.gray(T)}
|
|
30
|
-
${qb(this.state)} ${b.message}
|
|
31
|
-
`;switch(this.state){case"submit":return`${$}${U.default.gray(T)} ${I(this.options[this.cursor],"selected")}`;case"cancel":return`${$}${U.default.gray(T)} ${I(this.options[this.cursor],"cancelled")}
|
|
32
|
-
${U.default.gray(T)}`;default:return`${$}${U.default.cyan(T)} ${v4({cursor:this.cursor,options:this.options,maxItems:b.maxItems,style:(H,Y)=>I(H,Y?"active":"inactive")}).join(`
|
|
33
|
-
${U.default.cyan(T)} `)}
|
|
34
|
-
${U.default.cyan(a)}
|
|
35
|
-
`}}}).prompt()},i=(b="",I="")=>{let $=`
|
|
36
|
-
${b}
|
|
37
|
-
`.split(`
|
|
38
|
-
`),H=Yb(I).length,Y=Math.max($.reduce((G,Z)=>{let J=Yb(Z);return J.length>G?J.length:G},0),H)+2,X=$.map((G)=>`${U.default.gray(T)} ${U.default.dim(G)}${" ".repeat(Y-Yb(G).length)}${U.default.gray(T)}`).join(`
|
|
39
|
-
`);process.stdout.write(`${U.default.gray(T)}
|
|
40
|
-
${U.default.green(Jb)} ${U.default.reset(I)} ${U.default.gray(EI.repeat(Math.max(Y-H-1,1))+E4)}
|
|
41
|
-
${X}
|
|
42
|
-
${U.default.gray(y4+EI.repeat(Y+2)+P4)}
|
|
43
|
-
`)},wI=(b="")=>{process.stdout.write(`${U.default.gray(a)} ${U.default.red(b)}
|
|
44
|
-
|
|
45
|
-
`)},xI=(b="")=>{process.stdout.write(`${U.default.gray(R4)} ${b}
|
|
46
|
-
`)},kI=(b="")=>{process.stdout.write(`${U.default.gray(T)}
|
|
47
|
-
${U.default.gray(a)} ${b}
|
|
48
|
-
|
|
49
|
-
`)},V,e$;var r=N(()=>{Hb();Hb();U=F(r1(),1),yI=F(a1(),1);_4=B4(),M4=B("\u25C6","*"),O4=B("\u25A0","x"),A4=B("\u25B2","x"),Jb=B("\u25C7","o"),R4=B("\u250C","T"),T=B("\u2502","|"),a=B("\u2514","\u2014"),Xb=B("\u25CF",">"),Zb=B("\u25CB"," "),r$=B("\u25FB","[\u2022]"),t$=B("\u25FC","[+]"),o$=B("\u25FB","[ ]"),s$=B("\u25AA","\u2022"),EI=B("\u2500","-"),E4=B("\u256E","+"),y4=B("\u251C","+"),P4=B("\u256F","+"),w4=B("\u25CF","\u2022"),x4=B("\u25C6","*"),k4=B("\u25B2","!"),F4=B("\u25A0","x"),V={message:(b="",{symbol:I=U.default.gray(T)}={})=>{let $=[`${U.default.gray(T)}`];if(b){let[H,...Y]=b.split(`
|
|
50
|
-
`);$.push(`${I} ${H}`,...Y.map((X)=>`${U.default.gray(T)} ${X}`))}process.stdout.write(`${$.join(`
|
|
51
|
-
`)}
|
|
52
|
-
`)},info:(b)=>{V.message(b,{symbol:U.default.blue(w4)})},success:(b)=>{V.message(b,{symbol:U.default.green(x4)})},step:(b)=>{V.message(b,{symbol:U.default.green(Jb)})},warn:(b)=>{V.message(b,{symbol:U.default.yellow(k4)})},warning:(b)=>{V.warn(b)},error:(b)=>{V.message(b,{symbol:U.default.red(F4)})}},e$=`${U.default.gray(T)} `});var FI=O((G6,C4)=>{C4.exports={name:"dotenv",version:"17.2.0",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var fI=O(($6,f)=>{var Qb=A("fs"),B1=A("path"),h4=A("os"),m4=A("crypto"),D4=FI(),Ub=D4.version,vI=["\uD83D\uDD10 encrypt with dotenvx: https://dotenvx.com","\uD83D\uDD10 prevent committing .env to code: https://dotenvx.com/precommit","\uD83D\uDD10 prevent building .env in docker: https://dotenvx.com/prebuild","\uD83D\uDEE0\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function f4(){return vI[Math.floor(Math.random()*vI.length)]}function t(b){if(typeof b==="string")return!["false","0","no","off",""].includes(b.toLowerCase());return Boolean(b)}function d4(){return process.stdout.isTTY}function c4(b){return d4()?`\x1B[2m${b}\x1B[0m`:b}var u4=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function g4(b){let I={},$=b.toString();$=$.replace(/\r\n?/mg,`
|
|
53
|
-
`);let H;while((H=u4.exec($))!=null){let Y=H[1],X=H[2]||"";X=X.trim();let G=X[0];if(X=X.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),G==='"')X=X.replace(/\\n/g,`
|
|
54
|
-
`),X=X.replace(/\\r/g,"\r");I[Y]=X}return I}function p4(b){b=b||{};let I=DI(b);b.path=I;let $=M.configDotenv(b);if(!$.parsed){let G=new Error(`MISSING_DATA: Cannot parse ${I} for an unknown reason`);throw G.code="MISSING_DATA",G}let H=mI(b).split(","),Y=H.length,X;for(let G=0;G<Y;G++)try{let Z=H[G].trim(),J=l4($,Z);X=M.decrypt(J.ciphertext,J.key);break}catch(Z){if(G+1>=Y)throw Z}return M.parse(X)}function n4(b){console.error(`[dotenv@${Ub}][WARN] ${b}`)}function $1(b){console.log(`[dotenv@${Ub}][DEBUG] ${b}`)}function hI(b){console.log(`[dotenv@${Ub}] ${b}`)}function mI(b){if(b&&b.DOTENV_KEY&&b.DOTENV_KEY.length>0)return b.DOTENV_KEY;if(process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0)return process.env.DOTENV_KEY;return""}function l4(b,I){let $;try{$=new URL(I)}catch(Z){if(Z.code==="ERR_INVALID_URL"){let J=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw J.code="INVALID_DOTENV_KEY",J}throw Z}let H=$.password;if(!H){let Z=new Error("INVALID_DOTENV_KEY: Missing key part");throw Z.code="INVALID_DOTENV_KEY",Z}let Y=$.searchParams.get("environment");if(!Y){let Z=new Error("INVALID_DOTENV_KEY: Missing environment part");throw Z.code="INVALID_DOTENV_KEY",Z}let X=`DOTENV_VAULT_${Y.toUpperCase()}`,G=b.parsed[X];if(!G){let Z=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${X} in your .env.vault file.`);throw Z.code="NOT_FOUND_DOTENV_ENVIRONMENT",Z}return{ciphertext:G,key:H}}function DI(b){let I=null;if(b&&b.path&&b.path.length>0)if(Array.isArray(b.path)){for(let $ of b.path)if(Qb.existsSync($))I=$.endsWith(".vault")?$:`${$}.vault`}else I=b.path.endsWith(".vault")?b.path:`${b.path}.vault`;else I=B1.resolve(process.cwd(),".env.vault");if(Qb.existsSync(I))return I;return null}function CI(b){return b[0]==="~"?B1.join(h4.homedir(),b.slice(1)):b}function a4(b){let I=t(process.env.DOTENV_CONFIG_DEBUG||b&&b.debug),$=t(process.env.DOTENV_CONFIG_QUIET||b&&b.quiet);if(I||!$)hI("Loading env from encrypted .env.vault");let H=M._parseVault(b),Y=process.env;if(b&&b.processEnv!=null)Y=b.processEnv;return M.populate(Y,H,b),{parsed:H}}function i4(b){let I=B1.resolve(process.cwd(),".env"),$="utf8",H=process.env;if(b&&b.processEnv!=null)H=b.processEnv;let Y=t(H.DOTENV_CONFIG_DEBUG||b&&b.debug),X=t(H.DOTENV_CONFIG_QUIET||b&&b.quiet);if(b&&b.encoding)$=b.encoding;else if(Y)$1("No encoding is specified. UTF-8 is used by default");let G=[I];if(b&&b.path)if(!Array.isArray(b.path))G=[CI(b.path)];else{G=[];for(let Q of b.path)G.push(CI(Q))}let Z,J={};for(let Q of G)try{let W=M.parse(Qb.readFileSync(Q,{encoding:$}));M.populate(J,W,b)}catch(W){if(Y)$1(`Failed to load ${Q} ${W.message}`);Z=W}let q=M.populate(H,J,b);if(Y=t(H.DOTENV_CONFIG_DEBUG||Y),X=t(H.DOTENV_CONFIG_QUIET||X),Y||!X){let Q=Object.keys(q).length,W=[];for(let z of G)try{let K=B1.relative(process.cwd(),z);W.push(K)}catch(K){if(Y)$1(`Failed to load ${z} ${K.message}`);Z=K}hI(`injecting env (${Q}) from ${W.join(",")} ${c4(`(tip: ${f4()})`)}`)}if(Z)return{parsed:J,error:Z};else return{parsed:J}}function r4(b){if(mI(b).length===0)return M.configDotenv(b);let I=DI(b);if(!I)return n4(`You set DOTENV_KEY but you are missing a .env.vault file at ${I}. Did you forget to build it?`),M.configDotenv(b);return M._configVault(b)}function t4(b,I){let $=Buffer.from(I.slice(-64),"hex"),H=Buffer.from(b,"base64"),Y=H.subarray(0,12),X=H.subarray(-16);H=H.subarray(12,-16);try{let G=m4.createDecipheriv("aes-256-gcm",$,Y);return G.setAuthTag(X),`${G.update(H)}${G.final()}`}catch(G){let Z=G instanceof RangeError,J=G.message==="Invalid key length",q=G.message==="Unsupported state or unable to authenticate data";if(Z||J){let Q=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw Q.code="INVALID_DOTENV_KEY",Q}else if(q){let Q=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw Q.code="DECRYPTION_FAILED",Q}else throw G}}function o4(b,I,$={}){let H=Boolean($&&$.debug),Y=Boolean($&&$.override),X={};if(typeof I!=="object"){let G=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw G.code="OBJECT_REQUIRED",G}for(let G of Object.keys(I))if(Object.prototype.hasOwnProperty.call(b,G)){if(Y===!0)b[G]=I[G],X[G]=I[G];if(H)if(Y===!0)$1(`"${G}" is already defined and WAS overwritten`);else $1(`"${G}" is already defined and was NOT overwritten`)}else b[G]=I[G],X[G]=I[G];return X}var M={configDotenv:i4,_configVault:a4,_parseVault:p4,config:r4,decrypt:t4,parse:g4,populate:o4};$6.configDotenv=M.configDotenv;$6._configVault=M._configVault;$6._parseVault=M._parseVault;$6.config=M.config;$6.decrypt=M.decrypt;$6.parse=M.parse;$6.populate=M.populate;f.exports=M});import{existsSync as dI,readFileSync as cI}from"fs";import{join as uI}from"path";function nI(b){let I;try{I=uI(process.cwd(),".commit-wizardrc")}catch{I="/tmp/.commit-wizardrc"}let $=uI(process.env.HOME||process.env.USERPROFILE||"/tmp",".commit-wizardrc"),H={...Y3};try{if(dI($)){let X=cI($,"utf-8"),G=JSON.parse(X);H=gI(H,G)}}catch{console.warn("\u26A0\uFE0F Erro ao ler configura\xE7\xE3o global: Erro desconhecido")}let Y=b||I;try{if(dI(Y)){let X=cI(Y,"utf-8"),G=JSON.parse(X);H=gI(H,G)}}catch{console.warn("\u26A0\uFE0F Erro ao ler .commit-wizardrc: Erro desconhecido")}if(H.openai.apiKey=process.env.OPENAI_API_KEY,process.env.COMMIT_WIZARD_DEBUG==="true");if(process.env.COMMIT_WIZARD_DRY_RUN==="true")H.dryRun=!0;return H}function gI(b,I){return{...b,...I,openai:{...b.openai,...I.openai},smartSplit:{...b.smartSplit,...I.smartSplit},cache:{...b.cache,...I.cache}}}function lI(b){let I=[];if(!b.openai.apiKey)I.push("OPENAI_API_KEY n\xE3o encontrada nas vari\xE1veis de ambiente");if(b.openai.maxTokens<10||b.openai.maxTokens>4000)I.push("maxTokens deve estar entre 10 e 4000");if(b.openai.temperature<0||b.openai.temperature>2)I.push("temperature deve estar entre 0 e 2");if(!["pt","en","es","fr","de","it","ja","ko","zh"].includes(b.language))I.push("language deve ser um idioma suportado (pt, en, es, fr, de, it, ja, ko, zh)");if(!["conventional","simple","detailed"].includes(b.commitStyle))I.push("commitStyle deve ser conventional, simple ou detailed");if(b.smartSplit.minGroupSize<1)I.push("smartSplit.minGroupSize deve ser pelo menos 1");if(b.smartSplit.maxGroups<1||b.smartSplit.maxGroups>10)I.push("smartSplit.maxGroups deve estar entre 1 e 10");if(b.smartSplit.confidenceThreshold<0||b.smartSplit.confidenceThreshold>1)I.push("smartSplit.confidenceThreshold deve estar entre 0 e 1");if(b.cache.ttl<1)I.push("cache.ttl deve ser pelo menos 1 minuto");if(b.cache.maxSize<1)I.push("cache.maxSize deve ser pelo menos 1");return I}var pI,Y3;var aI=N(()=>{pI=F(fI(),1);pI.default.config();Y3={openai:{model:"gpt-4o",maxTokens:150,temperature:0.7,timeout:30000,retries:2},language:"pt",commitStyle:"conventional",autoCommit:!1,splitCommits:!1,dryRun:!1,smartSplit:{enabled:!0,minGroupSize:1,maxGroups:5,confidenceThreshold:0.7},cache:{enabled:!0,ttl:60,maxSize:100}}});var c={};b1(c,{isGitRepository:()=>Vb,getGitStatus:()=>Wb,getFileDiff:()=>X3,getDiffStats:()=>zb,executeFileCommit:()=>H1,executeCommit:()=>u,escapeShellArg:()=>_1});import{execSync as d}from"child_process";function _1(b){return`'${b.replace(/'/g,`'"'"'`)}'`}function Vb(){try{return d("git rev-parse --git-dir",{stdio:"ignore"}),!0}catch{return!1}}function Wb(){try{let I=d("git diff --cached --name-only",{encoding:"utf-8",stdio:"pipe"}).trim().split(`
|
|
55
|
-
`).filter((H)=>H.length>0),$=I.length>0?d("git diff --cached",{encoding:"utf-8",stdio:"pipe"}):"";return{hasStaged:I.length>0,stagedFiles:I,diff:$.trim()}}catch(b){throw new Error(`Erro ao obter status do Git: ${b instanceof Error?b.message:"Erro desconhecido"}`)}}function X3(b){try{return d(`git diff --cached -- "${b}"`,{encoding:"utf-8",stdio:"pipe"})}catch(I){throw new Error(`Erro ao obter diff do arquivo ${b}: ${I instanceof Error?I.message:"Erro desconhecido"}`)}}function u(b){try{let I=_1(b);return d(`git commit -m ${I}`,{stdio:"pipe"}),{success:!0,hash:d("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:b}}catch(I){return{success:!1,error:I instanceof Error?I.message:"Erro desconhecido ao executar commit"}}}function H1(b,I){try{let $=_1(I),H=_1(b);return d(`git commit ${H} -m ${$}`,{stdio:"pipe"}),{success:!0,hash:d("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:I}}catch($){return{success:!1,error:$ instanceof Error?$.message:"Erro desconhecido ao executar commit do arquivo"}}}function zb(){try{let I=d("git diff --cached --numstat",{encoding:"utf-8",stdio:"pipe"}).trim().split(`
|
|
56
|
-
`).filter((Y)=>Y.length>0),$=0,H=0;return I.forEach((Y)=>{let[X,G]=Y.split("\t");if(X&&X!=="-")$+=parseInt(X)||0;if(G&&G!=="-")H+=parseInt(G)||0}),{added:$,removed:H,files:I.length}}catch{return{added:0,removed:0,files:0}}}var D=()=>{};var eI={};b1(eI,{processOpenAIMessage:()=>oI,generateWithRetry:()=>M1,generateCommitMessage:()=>sI,extractCommitTypeFromMessage:()=>rI,detectCommitType:()=>tI,buildPrompt:()=>iI});function iI(b,I,$){let H=I.language==="pt"?"portugu\xEAs":"english",Y=Z3(I.commitStyle,I.language),X=6000,G=b.length>6000?b.substring(0,6000)+`
|
|
57
|
-
... (diff truncado)`:b,Z=$.length>10?`${$.length} arquivos: ${$.slice(0,5).join(", ")}...`:$.join(", ");return`Gere mensagem de commit em ${H} (${I.commitStyle}).
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var je=Object.defineProperty;var b=(e,t)=>()=>(e&&(t=e(e=0)),t);var P=(e,t)=>{for(var o in t)je(e,o,{get:t[o],enumerable:!0})};import rt from"path";import{fileURLToPath as ct}from"url";var d=b(()=>{"use strict"});import{existsSync as re,readFileSync as ae}from"fs";import{join as ce}from"path";function le(e){let t;try{t=ce(process.cwd(),".commit-wizardrc")}catch{t="/tmp/.commit-wizardrc"}let o=ce(process.env.HOME||process.env.USERPROFILE||"/tmp",".commit-wizardrc"),i={...De};try{if(re(o)){let s=ae(o,"utf-8"),a=JSON.parse(s);i=me(i,a)}}catch{console.warn("\u26A0\uFE0F Erro ao ler configura\xE7\xE3o global: Erro desconhecido")}let n=e||t;try{if(re(n)){let s=ae(n,"utf-8"),a=JSON.parse(s);i=me(i,a)}}catch{console.warn("\u26A0\uFE0F Erro ao ler .commit-wizardrc: Erro desconhecido")}return i.openai.apiKey=process.env.OPENAI_API_KEY,process.env.COMMIT_WIZARD_DEBUG,process.env.COMMIT_WIZARD_DRY_RUN==="true"&&(i.dryRun=!0),i}function me(e,t){return{...e,...t,openai:{...e.openai,...t.openai},smartSplit:{...e.smartSplit,...t.smartSplit},cache:{...e.cache,...t.cache}}}function ue(e){let t=[];return e.openai.apiKey||t.push("OPENAI_API_KEY n\xE3o encontrada nas vari\xE1veis de ambiente"),(e.openai.maxTokens<10||e.openai.maxTokens>4e3)&&t.push("maxTokens deve estar entre 10 e 4000"),(e.openai.temperature<0||e.openai.temperature>2)&&t.push("temperature deve estar entre 0 e 2"),["pt","en","es","fr","de","it","ja","ko","zh"].includes(e.language)||t.push("language deve ser um idioma suportado (pt, en, es, fr, de, it, ja, ko, zh)"),["conventional","simple","detailed"].includes(e.commitStyle)||t.push("commitStyle deve ser conventional, simple ou detailed"),e.smartSplit.minGroupSize<1&&t.push("smartSplit.minGroupSize deve ser pelo menos 1"),(e.smartSplit.maxGroups<1||e.smartSplit.maxGroups>10)&&t.push("smartSplit.maxGroups deve estar entre 1 e 10"),(e.smartSplit.confidenceThreshold<0||e.smartSplit.confidenceThreshold>1)&&t.push("smartSplit.confidenceThreshold deve estar entre 0 e 1"),e.cache.ttl<1&&t.push("cache.ttl deve ser pelo menos 1 minuto"),e.cache.maxSize<1&&t.push("cache.maxSize deve ser pelo menos 1"),t}var De,pe=b(()=>{"use strict";d();De={openai:{model:"gpt-4o",maxTokens:150,temperature:.7,timeout:3e4,retries:2},language:"pt",commitStyle:"conventional",autoCommit:!1,splitCommits:!1,dryRun:!1,smartSplit:{enabled:!0,minGroupSize:1,maxGroups:5,confidenceThreshold:.7},cache:{enabled:!0,ttl:60,maxSize:100}}});var E={};P(E,{escapeShellArg:()=>T,executeCommit:()=>z,executeFileCommit:()=>j,getDiffStats:()=>J,getFileDiff:()=>Te,getGitStatus:()=>K,isGitRepository:()=>V});import{execSync as A}from"child_process";function T(e){return`'${e.replace(/'/g,`'"'"'`)}'`}function V(){try{return A("git rev-parse --git-dir",{stdio:"ignore"}),!0}catch{return!1}}function K(){try{let t=A("git diff --cached --name-only",{encoding:"utf-8",stdio:"pipe"}).trim().split(`
|
|
3
|
+
`).filter(i=>i.length>0),o=t.length>0?A("git diff --cached",{encoding:"utf-8",stdio:"pipe"}):"";return{hasStaged:t.length>0,stagedFiles:t,diff:o.trim()}}catch(e){throw new Error(`Erro ao obter status do Git: ${e instanceof Error?e.message:"Erro desconhecido"}`)}}function Te(e){try{return A(`git diff --cached -- "${e}"`,{encoding:"utf-8",stdio:"pipe"})}catch(t){throw new Error(`Erro ao obter diff do arquivo ${e}: ${t instanceof Error?t.message:"Erro desconhecido"}`)}}function z(e){try{let t=T(e);return A(`git commit -m ${t}`,{stdio:"pipe"}),{success:!0,hash:A("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:e}}catch(t){return{success:!1,error:t instanceof Error?t.message:"Erro desconhecido ao executar commit"}}}function j(e,t){try{let o=T(t),i=T(e);return A(`git commit ${i} -m ${o}`,{stdio:"pipe"}),{success:!0,hash:A("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:t}}catch(o){return{success:!1,error:o instanceof Error?o.message:"Erro desconhecido ao executar commit do arquivo"}}}function J(){try{let t=A("git diff --cached --numstat",{encoding:"utf-8",stdio:"pipe"}).trim().split(`
|
|
4
|
+
`).filter(n=>n.length>0),o=0,i=0;return t.forEach(n=>{let[s,a]=n.split(" ");s&&s!=="-"&&(o+=parseInt(s)||0),a&&a!=="-"&&(i+=parseInt(a)||0)}),{added:o,removed:i,files:t.length}}catch{return{added:0,removed:0,files:0}}}var S=b(()=>{"use strict";d()});var xe={};P(xe,{buildPrompt:()=>de,detectCommitType:()=>ge,extractCommitTypeFromMessage:()=>fe,generateCommitMessage:()=>ye,generateWithRetry:()=>q,processOpenAIMessage:()=>he});function de(e,t,o){let i=t.language==="pt"?"portugu\xEAs":"english",n=qe(t.commitStyle,t.language),s=6e3,a=e.length>s?e.substring(0,s)+`
|
|
5
|
+
... (diff truncado)`:e,c=o.length>10?`${o.length} arquivos: ${o.slice(0,5).join(", ")}...`:o.join(", ");return`Gere mensagem de commit em ${i} (${t.commitStyle}).
|
|
58
6
|
|
|
59
|
-
Arquivos: ${
|
|
7
|
+
Arquivos: ${c}
|
|
60
8
|
|
|
61
|
-
${
|
|
9
|
+
${n}
|
|
62
10
|
|
|
63
11
|
Diff:
|
|
64
12
|
\`\`\`
|
|
65
|
-
${
|
|
13
|
+
${a}
|
|
66
14
|
\`\`\`
|
|
67
15
|
|
|
68
|
-
Mensagem:`}function
|
|
16
|
+
Mensagem:`}function qe(e,t){let o={pt:{conventional:`- Use formato: tipo(escopo): descri\xE7\xE3o
|
|
69
17
|
- Tipos v\xE1lidos: feat, fix, docs, style, refactor, test, chore, build, ci
|
|
70
18
|
- Exemplo: "feat(auth): adicionar valida\xE7\xE3o de email"
|
|
71
19
|
- Mantenha a primeira linha com at\xE9 50 caracteres`,simple:`- Use formato simples e direto
|
|
@@ -83,31 +31,25 @@ Mensagem:`}function Z3(b,I){let $={pt:{conventional:`- Use formato: tipo(escopo)
|
|
|
83
31
|
- Maximum 50 characters`,detailed:`- First line: summary under 50 characters
|
|
84
32
|
- Add explanatory body if needed
|
|
85
33
|
- Use imperative mood
|
|
86
|
-
- Be descriptive but concise`}},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
${
|
|
91
|
-
`);if(h)H.originalMessage=H.message,H.message=R;else H=new Error(R);if(H.shortMessage=m,H.command=G,H.escapedCommand=Z,H.exitCode=X,H.signal=Y,H.signalDescription=K,H.stdout=b,H.stderr=I,H.cwd=z,$!==void 0)H.all=$;if("bufferedData"in H)delete H.bufferedData;return H.failed=!0,H.timedOut=Boolean(J),H.isCanceled=q,H.killed=Q&&!J,H};var q2=N(()=>{J2()});var P1,QG=(b)=>P1.some((I)=>b[I]!==void 0),Q2=(b)=>{if(!b)return;let{stdio:I}=b;if(I===void 0)return P1.map((H)=>b[H]);if(QG(b))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${P1.map((H)=>`\`${H}\``).join(", ")}`);if(typeof I==="string")return I;if(!Array.isArray(I))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof I}\``);let $=Math.max(I.length,P1.length);return Array.from({length:$},(H,Y)=>I[Y])};var U2=N(()=>{P1=["stdin","stdout","stderr"]});var p;var V2=N(()=>{p=[];p.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")p.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")p.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class W2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(kb[xb])return kb[xb];UG(kb,xb,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(b,I){this.listeners[b].push(I)}removeListener(b,I){let $=this.listeners[b],H=$.indexOf(I);if(H===-1)return;if(H===0&&$.length===1)$.length=0;else $.splice(H,1)}emit(b,I,$){if(this.emitted[b])return!1;this.emitted[b]=!0;let H=!1;for(let Y of this.listeners[b])H=Y(I,$)===!0||H;if(b==="exit")H=this.emit("afterExit",I,$)||H;return H}}class vb{}var w1=(b)=>!!b&&typeof b==="object"&&typeof b.removeListener==="function"&&typeof b.emit==="function"&&typeof b.reallyExit==="function"&&typeof b.listeners==="function"&&typeof b.kill==="function"&&typeof b.pid==="number"&&typeof b.on==="function",xb,kb,UG,VG=(b)=>{return{onExit(I,$){return b.onExit(I,$)},load(){return b.load()},unload(){return b.unload()}}},z2,N2,Fb,K2,H8,Y8;var j2=N(()=>{V2();xb=Symbol.for("signal-exit emitter"),kb=globalThis,UG=Object.defineProperty.bind(Object);z2=class z2 extends vb{onExit(){return()=>{}}load(){}unload(){}};N2=class N2 extends vb{#X=Fb.platform==="win32"?"SIGINT":"SIGHUP";#I=new W2;#b;#H;#Y;#$={};#G=!1;constructor(b){super();this.#b=b,this.#$={};for(let I of p)this.#$[I]=()=>{let $=this.#b.listeners(I),{count:H}=this.#I,Y=b;if(typeof Y.__signal_exit_emitter__==="object"&&typeof Y.__signal_exit_emitter__.count==="number")H+=Y.__signal_exit_emitter__.count;if($.length===H){this.unload();let X=this.#I.emit("exit",null,I),G=I==="SIGHUP"?this.#X:I;if(!X)b.kill(b.pid,G)}};this.#Y=b.reallyExit,this.#H=b.emit}onExit(b,I){if(!w1(this.#b))return()=>{};if(this.#G===!1)this.load();let $=I?.alwaysLast?"afterExit":"exit";return this.#I.on($,b),()=>{if(this.#I.removeListener($,b),this.#I.listeners.exit.length===0&&this.#I.listeners.afterExit.length===0)this.unload()}}load(){if(this.#G)return;this.#G=!0,this.#I.count+=1;for(let b of p)try{let I=this.#$[b];if(I)this.#b.on(b,I)}catch(I){}this.#b.emit=(b,...I)=>{return this.#J(b,...I)},this.#b.reallyExit=(b)=>{return this.#Z(b)}}unload(){if(!this.#G)return;this.#G=!1,p.forEach((b)=>{let I=this.#$[b];if(!I)throw new Error("Listener not defined for signal: "+b);try{this.#b.removeListener(b,I)}catch($){}}),this.#b.emit=this.#H,this.#b.reallyExit=this.#Y,this.#I.count-=1}#Z(b){if(!w1(this.#b))return 0;return this.#b.exitCode=b||0,this.#I.emit("exit",this.#b.exitCode,null),this.#Y.call(this.#b,this.#b.exitCode)}#J(b,...I){let $=this.#H;if(b==="exit"&&w1(this.#b)){if(typeof I[0]==="number")this.#b.exitCode=I[0];let H=$.call(this.#b,b,...I);return this.#I.emit("exit",this.#b.exitCode,null),H}else return $.call(this.#b,b,...I)}};Fb=globalThis.process,{onExit:K2,load:H8,unload:Y8}=VG(w1(Fb)?new N2(Fb):new z2)});import WG from"os";var zG=5000,S2=(b,I="SIGTERM",$={})=>{let H=b(I);return NG(b,I,$,H),H},NG=(b,I,$,H)=>{if(!KG(I,$,H))return;let Y=SG($),X=setTimeout(()=>{b("SIGKILL")},Y);if(X.unref)X.unref()},KG=(b,{forceKillAfterTimeout:I},$)=>jG(b)&&I!==!1&&$,jG=(b)=>b===WG.constants.signals.SIGTERM||typeof b==="string"&&b.toUpperCase()==="SIGTERM",SG=({forceKillAfterTimeout:b=!0})=>{if(b===!0)return zG;if(!Number.isFinite(b)||b<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${b}\` (${typeof b})`);return b},T2=(b,I)=>{if(b.kill())I.isCanceled=!0},TG=(b,I,$)=>{b.kill(I),$(Object.assign(new Error("Timed out"),{timedOut:!0,signal:I}))},L2=(b,{timeout:I,killSignal:$="SIGTERM"},H)=>{if(I===0||I===void 0)return H;let Y,X=new Promise((Z,J)=>{Y=setTimeout(()=>{TG(b,$,J)},I)}),G=H.finally(()=>{clearTimeout(Y)});return Promise.race([X,G])},B2=({timeout:b})=>{if(b!==void 0&&(!Number.isFinite(b)||b<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${b}\` (${typeof b})`)},_2=async(b,{cleanup:I,detached:$},H)=>{if(!I||$)return H;let Y=K2(()=>{b.kill()});return H.finally(()=>{Y()})};var M2=N(()=>{j2()});function x1(b){return b!==null&&typeof b==="object"&&typeof b.pipe==="function"}function Cb(b){return x1(b)&&b.writable!==!1&&typeof b._write==="function"&&typeof b._writableState==="object"}import{createWriteStream as LG}from"fs";import{ChildProcess as BG}from"child_process";var _G=(b)=>b instanceof BG&&typeof b.then==="function",hb=(b,I,$)=>{if(typeof $==="string")return b[I].pipe(LG($)),b;if(Cb($))return b[I].pipe($),b;if(!_G($))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Cb($.stdin))throw new TypeError("The target child process's stdin must be available.");return b[I].pipe($.stdin),$},O2=(b)=>{if(b.stdout!==null)b.pipeStdout=hb.bind(void 0,b,"stdout");if(b.stderr!==null)b.pipeStderr=hb.bind(void 0,b,"stderr");if(b.all!==void 0)b.pipeAll=hb.bind(void 0,b,"all")};var A2=()=>{};var Z1=async(b,{init:I,convertChunk:$,getSize:H,truncateChunk:Y,addChunk:X,getFinalChunk:G,finalize:Z},{maxBuffer:J=Number.POSITIVE_INFINITY}={})=>{if(!OG(b))throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");let q=I();q.length=0;try{for await(let Q of b){let W=AG(Q),z=$[W](Q,q);y2({convertedChunk:z,state:q,getSize:H,truncateChunk:Y,addChunk:X,maxBuffer:J})}return MG({state:q,convertChunk:$,getSize:H,truncateChunk:Y,addChunk:X,getFinalChunk:G,maxBuffer:J}),Z(q)}catch(Q){throw Q.bufferedData=Z(q),Q}},MG=({state:b,getSize:I,truncateChunk:$,addChunk:H,getFinalChunk:Y,maxBuffer:X})=>{let G=Y(b);if(G!==void 0)y2({convertedChunk:G,state:b,getSize:I,truncateChunk:$,addChunk:H,maxBuffer:X})},y2=({convertedChunk:b,state:I,getSize:$,truncateChunk:H,addChunk:Y,maxBuffer:X})=>{let G=$(b),Z=I.length+G;if(Z<=X){R2(b,I,Y,Z);return}let J=H(b,X-I.length);if(J!==void 0)R2(J,I,Y,X);throw new mb},R2=(b,I,$,H)=>{I.contents=$(b,I,H),I.length=H},OG=(b)=>typeof b==="object"&&b!==null&&typeof b[Symbol.asyncIterator]==="function",AG=(b)=>{let I=typeof b;if(I==="string")return"string";if(I!=="object"||b===null)return"others";if(globalThis.Buffer?.isBuffer(b))return"buffer";let $=E2.call(b);if($==="[object ArrayBuffer]")return"arrayBuffer";if($==="[object DataView]")return"dataView";if(Number.isInteger(b.byteLength)&&Number.isInteger(b.byteOffset)&&E2.call(b.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},E2,mb;var J1=N(()=>{({toString:E2}=Object.prototype);mb=class mb extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Db=(b)=>b,fb=()=>{return},db=({contents:b})=>b,k1=(b)=>{throw new Error(`Streams in object mode are not supported: ${String(b)}`)},F1=(b)=>b.length;var P2=N(()=>{J1()});async function cb(b,I){return Z1(b,vG,I)}var RG=()=>({contents:new ArrayBuffer(0)}),EG=(b)=>yG.encode(b),yG,w2=(b)=>new Uint8Array(b),x2=(b)=>new Uint8Array(b.buffer,b.byteOffset,b.byteLength),PG=(b,I)=>b.slice(0,I),wG=(b,{contents:I,length:$},H)=>{let Y=v2()?kG(I,H):xG(I,H);return new Uint8Array(Y).set(b,$),Y},xG=(b,I)=>{if(I<=b.byteLength)return b;let $=new ArrayBuffer(F2(I));return new Uint8Array($).set(new Uint8Array(b),0),$},kG=(b,I)=>{if(I<=b.maxByteLength)return b.resize(I),b;let $=new ArrayBuffer(I,{maxByteLength:F2(I)});return new Uint8Array($).set(new Uint8Array(b),0),$},F2=(b)=>k2**Math.ceil(Math.log(b)/Math.log(k2)),k2=2,FG=({contents:b,length:I})=>v2()?b:b.slice(0,I),v2=()=>("resize"in ArrayBuffer.prototype),vG;var ub=N(()=>{J1();yG=new TextEncoder,vG={init:RG,convertChunk:{string:EG,buffer:w2,arrayBuffer:w2,dataView:x2,typedArray:x2,others:k1},getSize:F1,truncateChunk:PG,addChunk:wG,getFinalChunk:fb,finalize:FG}});async function v1(b,I){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return C2(await cb(b,I))}catch($){if($.bufferedData!==void 0)$.bufferedData=C2($.bufferedData);throw $}}var C2=(b)=>globalThis.Buffer.from(b);var h2=N(()=>{ub()});async function gb(b,I){return Z1(b,fG,I)}var CG=()=>({contents:"",textDecoder:new TextDecoder}),C1=(b,{textDecoder:I})=>I.decode(b,{stream:!0}),hG=(b,{contents:I})=>I+b,mG=(b,I)=>b.slice(0,I),DG=({textDecoder:b})=>{let I=b.decode();return I===""?void 0:I},fG;var m2=N(()=>{J1();fG={init:CG,convertChunk:{string:Db,buffer:C1,arrayBuffer:C1,dataView:C1,typedArray:C1,others:k1},getSize:F1,truncateChunk:mG,addChunk:hG,getFinalChunk:DG,finalize:db}});var D2=N(()=>{P2();ub();h2();m2();J1()});var d2=O((C8,f2)=>{var{PassThrough:dG}=A("stream");f2.exports=function(){var b=[],I=new dG({objectMode:!0});return I.setMaxListeners(0),I.add=$,I.isEmpty=H,I.on("unpipe",Y),Array.prototype.slice.call(arguments).forEach($),I;function $(X){if(Array.isArray(X))return X.forEach($),this;return b.push(X),X.once("end",Y.bind(null,X)),X.once("error",I.emit.bind(I,"error")),X.pipe(I,{end:!1}),this}function H(){return b.length==0}function Y(X){if(b=b.filter(function(G){return G!==X}),!b.length&&I.readable)I.end()}}});import{createReadStream as cG,readFileSync as uG}from"fs";import{setTimeout as gG}from"timers/promises";var c2,u2=(b)=>{if(b!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},pG=({input:b,inputFile:I})=>{if(typeof I!=="string")return b;return u2(b),uG(I)},g2=(b)=>{let I=pG(b);if(x1(I))throw new TypeError("The `input` option cannot be a stream in sync mode");return I},nG=({input:b,inputFile:I})=>{if(typeof I!=="string")return b;return u2(b),cG(I)},p2=(b,I)=>{let $=nG(I);if($===void 0)return;if(x1($))$.pipe(b.stdin);else b.stdin.end($)},n2=(b,{all:I})=>{if(!I||!b.stdout&&!b.stderr)return;let $=c2.default();if(b.stdout)$.add(b.stdout);if(b.stderr)$.add(b.stderr);return $},pb=async(b,I)=>{if(!b||I===void 0)return;await gG(0),b.destroy();try{return await I}catch($){return $.bufferedData}},nb=(b,{encoding:I,buffer:$,maxBuffer:H})=>{if(!b||!$)return;if(I==="utf8"||I==="utf-8")return gb(b,{maxBuffer:H});if(I===null||I==="buffer")return v1(b,{maxBuffer:H});return lG(b,H,I)},lG=async(b,I,$)=>{return(await v1(b,{maxBuffer:I})).toString($)},l2=async({stdout:b,stderr:I,all:$},{encoding:H,buffer:Y,maxBuffer:X},G)=>{let Z=nb(b,{encoding:H,buffer:Y,maxBuffer:X}),J=nb(I,{encoding:H,buffer:Y,maxBuffer:X}),q=nb($,{encoding:H,buffer:Y,maxBuffer:X*2});try{return await Promise.all([G,Z,J,q])}catch(Q){return Promise.all([{error:Q,signal:Q.signal,timedOut:Q.timedOut},pb(b,Z),pb(I,J),pb($,q)])}};var a2=N(()=>{D2();c2=F(d2(),1)});var aG,iG,lb=(b,I)=>{for(let[$,H]of iG){let Y=typeof I==="function"?(...X)=>Reflect.apply(H.value,I(),X):H.value.bind(I);Reflect.defineProperty(b,$,{...H,value:Y})}},i2=(b)=>new Promise((I,$)=>{if(b.on("exit",(H,Y)=>{I({exitCode:H,signal:Y})}),b.on("error",(H)=>{$(H)}),b.stdin)b.stdin.on("error",(H)=>{$(H)})});var r2=N(()=>{aG=(async()=>{})().constructor.prototype,iG=["then","catch","finally"].map((b)=>[b,Reflect.getOwnPropertyDescriptor(aG,b)])});import{Buffer as rG}from"buffer";import{ChildProcess as tG}from"child_process";var s2=(b,I=[])=>{if(!Array.isArray(I))return[b];return[b,...I]},oG,sG=(b)=>{if(typeof b!=="string"||oG.test(b))return b;return`"${b.replaceAll('"',"\\\"")}"`},ab=(b,I)=>s2(b,I).join(" "),ib=(b,I)=>s2(b,I).map(($)=>sG($)).join(" "),eG,t2=(b)=>{let I=typeof b;if(I==="string")return b;if(I==="number")return String(b);if(I==="object"&&b!==null&&!(b instanceof tG)&&"stdout"in b){let $=typeof b.stdout;if($==="string")return b.stdout;if(rG.isBuffer(b.stdout))return b.stdout.toString();throw new TypeError(`Unexpected "${$}" stdout in template expression`)}throw new TypeError(`Unexpected "${I}" in template expression`)},o2=(b,I,$)=>$||b.length===0||I.length===0?[...b,...I]:[...b.slice(0,-1),`${b.at(-1)}${I[0]}`,...I.slice(1)],b$=({templates:b,expressions:I,tokens:$,index:H,template:Y})=>{let X=Y??b.raw[H],G=X.split(eG).filter(Boolean),Z=o2($,G,X.startsWith(" "));if(H===I.length)return Z;let J=I[H],q=Array.isArray(J)?J.map((Q)=>t2(Q)):[t2(J)];return o2(Z,q,X.endsWith(" "))},rb=(b,I)=>{let $=[];for(let[H,Y]of b.entries())$=b$({templates:b,expressions:I,tokens:$,index:H,template:Y});return $};var e2=N(()=>{oG=/^[\w.-]+$/,eG=/ +/g});import{debuglog as I$}from"util";import G$ from"process";var b9,h1=(b,I)=>String(b).padStart(I,"0"),$$=()=>{let b=new Date;return`${h1(b.getHours(),2)}:${h1(b.getMinutes(),2)}:${h1(b.getSeconds(),2)}.${h1(b.getMilliseconds(),3)}`},tb=(b,{verbose:I})=>{if(!I)return;G$.stderr.write(`[${$$()}] ${b}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
**Arquivos:** ${b.files.join(", ")}
|
|
102
|
-
**Mensagem:** "${I}"`,"\uD83D\uDE80 Confirmar Commit do Grupo");let $=await g({message:`Fazer commit para "${b.name}"?`});if(P($))return!1;return $}function O$(b,I,$){let H=Math.round(b/I*100),Y="\u2588".repeat(Math.floor(H/10))+"\u2591".repeat(10-Math.floor(H/10));V.info(`\uD83D\uDD04 Progresso: [${Y}] ${H}% (${b}/${I})`),V.info(`\uD83D\uDCCB Processando: ${$}`)}var $I=N(()=>{r()});import A$ from"crypto";class w9{cache=new Map;config;constructor(b){this.config=b}generateHash(b,I){let $={files:b.sort(),diff:I.substring(0,1000),model:this.config.openai.model,temperature:this.config.openai.temperature};return A$.createHash("md5").update(JSON.stringify($)).digest("hex")}get(b,I){if(!this.config.cache.enabled)return{hit:!1};let $=this.generateHash(b,I),H=this.cache.get($);if(!H)return{hit:!1};let Y=Date.now(),X=this.config.cache.ttl*60*1000;if(Y-H.timestamp>X)return this.cache.delete($),{hit:!1};return{hit:!0,groups:H.groups}}set(b,I,$){if(!this.config.cache.enabled)return;if(this.cache.size>=this.config.cache.maxSize)this.cleanup();if(this.cache.size>=this.config.cache.maxSize)return;let H=this.generateHash(b,I),Y={groups:$,timestamp:Date.now(),hash:H};this.cache.set(H,Y)}cleanup(){let b=Date.now(),I=this.config.cache.ttl*60*1000;for(let[$,H]of this.cache.entries())if(b-H.timestamp>I)this.cache.delete($);if(this.cache.size>=this.config.cache.maxSize){let H=Array.from(this.cache.entries()).sort((Y,X)=>Y[1].timestamp-X[1].timestamp).slice(0,Math.ceil(this.config.cache.maxSize*0.5));for(let[Y]of H)this.cache.delete(Y)}}clear(){this.cache.clear()}getStats(){return{size:this.cache.size,maxSize:this.config.cache.maxSize,enabled:this.config.cache.enabled}}}function k9(b){x9=new w9(b)}function F9(){return x9}function v9(b,I){let $=F9();return $?$.get(b,I):{hit:!1}}function C9(b,I,$){let H=F9();if(H)H.set(b,I,$)}var x9=null;var HI=()=>{};function R$(b,I){let H=I.length>8000?I.substring(0,8000)+`
|
|
103
|
-
... (diff truncado)`:I,Y=b.length,X=b.reduce((Z,J)=>{let q=J.split(".").pop()||"sem-extensao";return Z[q]=(Z[q]||0)+1,Z},{}),G=Object.entries(X).map(([Z,J])=>`${Z}: ${J}`).join(", ");return`Analise os arquivos modificados e agrupe em commits l\xF3gicos.
|
|
104
|
-
|
|
105
|
-
ARQUIVOS (${Y}): ${b.join(", ")}
|
|
106
|
-
TIPOS: ${G}
|
|
34
|
+
- Be descriptive but concise`}},i=t==="pt"?"pt":"en";return o[i][e]||o[i].conventional}function fe(e){let t={feat:/^(feat|feature)(\([^)]+\))?:/i,fix:/^(fix|bugfix)(\([^)]+\))?:/i,docs:/^(docs|documentation)(\([^)]+\))?:/i,style:/^(style|format)(\([^)]+\))?:/i,refactor:/^(refactor|refactoring)(\([^)]+\))?:/i,test:/^(test|testing)(\([^)]+\))?:/i,chore:/^(chore|maintenance)(\([^)]+\))?:/i,build:/^(build|ci)(\([^)]+\))?:/i,ci:/^(ci|continuous-integration)(\([^)]+\))?:/i};for(let[o,i]of Object.entries(t))if(i.test(e))return o;return null}function ge(e,t){let o=e.toLowerCase(),i=t.join(" ").toLowerCase();return i.includes("test")||i.includes("spec")||o.includes("test(")?"test":i.includes("readme")||i.includes(".md")||i.includes("docs")?"docs":i.includes("package.json")||i.includes("dockerfile")||i.includes(".yml")||i.includes(".yaml")||i.includes("webpack")||i.includes("tsconfig")?"build":i.includes(".css")||i.includes(".scss")||o.includes("style")||o.includes("format")?"style":o.includes("fix")||o.includes("bug")||o.includes("error")||o.includes("issue")?"fix":o.includes("add")||o.includes("new")||o.includes("create")||o.includes("implement")?"feat":o.includes("refactor")||o.includes("restructure")||o.includes("rename")?"refactor":"chore"}function he(e){return e.match(/^```[\s\S]*```$/)&&(e=e.replace(/^```(?:plaintext|javascript|typescript|python|java|html|css|json|xml|yaml|yml|bash|shell|text)?\s*/,"").replace(/\s*```$/,"")),e=e.trim(),e}async function ye(e,t,o){try{if(!t.openai.apiKey)return{success:!1,error:"Chave da OpenAI n\xE3o encontrada. Configure OPENAI_API_KEY nas vari\xE1veis de ambiente."};let i=de(e,t,o),n=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${t.openai.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({model:t.openai.model,messages:[{role:"user",content:i}],max_tokens:Math.min(t.openai.maxTokens,150),temperature:t.openai.temperature})});if(!n.ok){let m=await n.json().catch(()=>({}));return{success:!1,error:`Erro da OpenAI (${n.status}): ${m.error?.message||"Erro desconhecido"}`}}let a=(await n.json()).choices?.[0]?.message?.content?.trim();if(!a)return{success:!1,error:"OpenAI retornou resposta vazia"};a=he(a);let c=fe(a),r=ge(e,o);return{success:!0,suggestion:{message:a,type:c||r,confidence:.8}}}catch(i){return{success:!1,error:`Erro ao conectar com OpenAI: ${i instanceof Error?i.message:"Erro desconhecido"}`}}}async function q(e,t,o,i=3){let n="";for(let s=0;s<i;s++){let a=await ye(e,t,o);if(a.success)return a;n=a.error||"Erro desconhecido",s<i-1&&await new Promise(c=>setTimeout(c,Math.pow(2,s)*1e3))}return{success:!1,error:`Falha ap\xF3s ${i} tentativas. \xDAltimo erro: ${n}`}}var W=b(()=>{"use strict";d()});var Q={};P(Q,{askContinueCommits:()=>Y,confirmCommit:()=>_e,copyToClipboard:()=>U,editCommitMessage:()=>L,selectFilesForCommit:()=>B,showCancellation:()=>G,showCommitPreview:()=>N,showCommitResult:()=>C});import{text as ke,select as Ne,confirm as k,log as R,note as Ce,cancel as Le,isCancel as F}from"@clack/prompts";import Ue from"clipboardy";async function N(e){Ce(`Tipo: ${e.type}
|
|
35
|
+
Mensagem: "${e.message}"`,"\u{1F4AD} Sugest\xE3o de Commit");let t=await Ne({message:"O que voc\xEA gostaria de fazer?",options:[{value:"commit",label:"\u2705 Fazer commit com esta mensagem",hint:"Executar git commit imediatamente"},{value:"edit",label:"\u270F\uFE0F Editar mensagem",hint:"Modificar a mensagem antes de commitar"},{value:"copy",label:"\u{1F4CB} Copiar para clipboard",hint:"Copiar mensagem e sair sem commitar"},{value:"cancel",label:"\u274C Cancelar",hint:"Sair sem fazer nada"}]});return F(t)?{action:"cancel"}:{action:t}}async function L(e){let t=await ke({message:"Edite a mensagem do commit:",initialValue:e,placeholder:"Digite a mensagem do commit...",validate:i=>{if(!i||i.trim().length===0)return"A mensagem n\xE3o pode estar vazia";if(i.trim().length>72)return"A mensagem est\xE1 muito longa (m\xE1ximo 72 caracteres recomendado)"}});if(F(t))return{action:"cancel"};let o=await k({message:`Confirma a mensagem editada: "${t}"?`});return F(o)||!o?{action:"cancel"}:{action:"commit",message:t}}async function U(e){try{return await Ue.write(e),R.success("\u2705 Mensagem copiada para a \xE1rea de transfer\xEAncia!"),!0}catch(t){return R.error(`\u274C Erro ao copiar: ${t instanceof Error?t.message:"Erro desconhecido"}`),!1}}async function _e(e){Ce(`"${e}"`,"\u{1F680} Confirmar Commit");let t=await k({message:"Executar o commit agora?"});return F(t)?!1:t}function C(e,t,o){e&&t?(R.success("\u2705 Commit realizado com sucesso!"),R.info(`\u{1F517} Hash: ${t.substring(0,8)}`)):R.error(`\u274C Erro ao realizar commit: ${o||"Erro desconhecido"}`)}async function B(e){R.info("\u{1F4CB} Modo Split: Selecione os arquivos para este commit");let t=[];for(let o of e){let i=await k({message:`Incluir "${o}" neste commit?`});if(F(i))break;i&&t.push(o)}return t}async function Y(e){if(e.length===0)return!1;R.info(`\u{1F4C4} Arquivos restantes: ${e.join(", ")}`);let t=await k({message:"Gerar commit para os arquivos restantes?"});return F(t)?!1:t}function G(){Le("Opera\xE7\xE3o cancelada pelo usu\xE1rio")}var D=b(()=>{"use strict";d()});var we={};P(we,{chooseSplitMode:()=>X,confirmGroupCommit:()=>Ke,showSmartSplitGroups:()=>Ve,showSmartSplitProgress:()=>Je});import{select as ve,confirm as He,log as Se,note as be,isCancel as Z}from"@clack/prompts";async function X(){let e=await ve({message:"Como voc\xEA gostaria de organizar os commits?",options:[{value:"smart",label:"\u{1F9E0} Smart Split (Recomendado)",hint:"IA analisa contexto e agrupa automaticamente"},{value:"manual",label:"\u270B Split Manual",hint:"Voc\xEA escolhe arquivos manualmente"},{value:"cancel",label:"\u274C Cancelar",hint:"Voltar ao modo normal"}]});return Z(e)?{action:"cancel"}:e==="manual"?{action:"manual"}:e==="smart"?{action:"proceed"}:{action:"cancel"}}async function Ve(e){be(`Identificamos ${e.length} grupo(s) l\xF3gico(s) para seus commits:
|
|
36
|
+
|
|
37
|
+
`+e.map((o,i)=>`${i+1}. **${o.name}**
|
|
38
|
+
\u{1F4C4} ${o.files.join(", ")}
|
|
39
|
+
\u{1F4A1} ${o.description}
|
|
40
|
+
\u{1F3AF} Confian\xE7a: ${Math.round(o.confidence*100)}%`).join(`
|
|
41
|
+
|
|
42
|
+
`),"\u{1F9E0} An\xE1lise de Contexto");let t=await ve({message:"O que voc\xEA gostaria de fazer?",options:[{value:"proceed",label:"\u2705 Prosseguir com esta organiza\xE7\xE3o",hint:"Usar os grupos como sugeridos pela IA"},{value:"manual",label:"\u270B Fazer split manual",hint:"Escolher arquivos manualmente"},{value:"cancel",label:"\u274C Cancelar",hint:"Voltar ao modo normal"}]});return Z(t)?{action:"cancel"}:t==="proceed"?{action:"proceed",groups:e}:{action:t}}async function Ke(e,t){be(`**Grupo:** ${e.name}
|
|
43
|
+
**Arquivos:** ${e.files.join(", ")}
|
|
44
|
+
**Mensagem:** "${t}"`,"\u{1F680} Confirmar Commit do Grupo");let o=await He({message:`Fazer commit para "${e.name}"?`});return Z(o)?!1:o}function Je(e,t,o){let i=Math.round(e/t*100),n="\u2588".repeat(Math.floor(i/10))+"\u2591".repeat(10-Math.floor(i/10));Se.info(`\u{1F504} Progresso: [${n}] ${i}% (${e}/${t})`),Se.info(`\u{1F4CB} Processando: ${o}`)}var ee=b(()=>{"use strict";d()});import We from"crypto";function Ae(e){$e=new te(e)}function Ee(){return $e}function Me(e,t){let o=Ee();return o?o.get(e,t):{hit:!1}}function ze(e,t,o){let i=Ee();i&&i.set(e,t,o)}var te,$e,ie=b(()=>{"use strict";d();te=class{cache=new Map;config;constructor(t){this.config=t}generateHash(t,o){let i={files:t.sort(),diff:o.substring(0,1e3),model:this.config.openai.model,temperature:this.config.openai.temperature};return We.createHash("md5").update(JSON.stringify(i)).digest("hex")}get(t,o){if(!this.config.cache.enabled)return{hit:!1};let i=this.generateHash(t,o),n=this.cache.get(i);if(!n)return{hit:!1};let s=Date.now(),a=this.config.cache.ttl*60*1e3;return s-n.timestamp>a?(this.cache.delete(i),{hit:!1}):{hit:!0,groups:n.groups}}set(t,o,i){if(!this.config.cache.enabled||(this.cache.size>=this.config.cache.maxSize&&this.cleanup(),this.cache.size>=this.config.cache.maxSize))return;let n=this.generateHash(t,o),s={groups:i,timestamp:Date.now(),hash:n};this.cache.set(n,s)}cleanup(){let t=Date.now(),o=this.config.cache.ttl*60*1e3;for(let[i,n]of this.cache.entries())t-n.timestamp>o&&this.cache.delete(i);if(this.cache.size>=this.config.cache.maxSize){let n=Array.from(this.cache.entries()).sort((s,a)=>s[1].timestamp-a[1].timestamp).slice(0,Math.ceil(this.config.cache.maxSize*.5));for(let[s]of n)this.cache.delete(s)}}clear(){this.cache.clear()}getStats(){return{size:this.cache.size,maxSize:this.config.cache.maxSize,enabled:this.config.cache.enabled}}},$e=null});import{log as f}from"@clack/prompts";function Be(e,t){let i=t.length>8e3?t.substring(0,8e3)+`
|
|
45
|
+
... (diff truncado)`:t,n=e.length,s=e.reduce((c,r)=>{let m=r.split(".").pop()||"sem-extensao";return c[m]=(c[m]||0)+1,c},{}),a=Object.entries(s).map(([c,r])=>`${c}: ${r}`).join(", ");return`Analise os arquivos modificados e agrupe em commits l\xF3gicos.
|
|
46
|
+
|
|
47
|
+
ARQUIVOS (${n}): ${e.join(", ")}
|
|
48
|
+
TIPOS: ${a}
|
|
107
49
|
|
|
108
50
|
DIFF RESUMIDO:
|
|
109
51
|
\`\`\`
|
|
110
|
-
${
|
|
52
|
+
${i}
|
|
111
53
|
\`\`\`
|
|
112
54
|
|
|
113
55
|
Agrupe arquivos relacionados. M\xE1ximo 5 grupos. Responda em JSON:
|
|
@@ -121,13 +63,13 @@ Agrupe arquivos relacionados. M\xE1ximo 5 grupos. Responda em JSON:
|
|
|
121
63
|
"confidence": 0.8
|
|
122
64
|
}
|
|
123
65
|
]
|
|
124
|
-
}`}function
|
|
66
|
+
}`}function Ye(e){let t=e.reduce((i,n)=>{let s=n.split("/").slice(0,-1).join("/")||"root";return i[s]||(i[s]=[]),i[s].push(n),i},{});return`Agrupe estes arquivos em commits l\xF3gicos baseado nos diret\xF3rios:
|
|
125
67
|
|
|
126
68
|
ARQUIVOS POR DIRET\xD3RIO:
|
|
127
|
-
${Object.entries(
|
|
69
|
+
${Object.entries(t).map(([i,n])=>`${i}: ${n.length} arquivo(s)`).join(`
|
|
128
70
|
`)}
|
|
129
71
|
|
|
130
|
-
LISTA COMPLETA: ${
|
|
72
|
+
LISTA COMPLETA: ${e.join(", ")}
|
|
131
73
|
|
|
132
74
|
Agrupe por funcionalidade relacionada. M\xE1ximo 5 grupos. JSON:
|
|
133
75
|
{
|
|
@@ -140,35 +82,35 @@ Agrupe por funcionalidade relacionada. M\xE1ximo 5 grupos. JSON:
|
|
|
140
82
|
"confidence": 0.7
|
|
141
83
|
}
|
|
142
84
|
]
|
|
143
|
-
}`}async function
|
|
144
|
-
... (diff truncado)`:
|
|
145
|
-
... (conte\xFAdo truncado)`:
|
|
85
|
+
}`}async function Qe(e,t,o){try{if(!o.openai.apiKey)return{success:!1,error:"Chave da OpenAI n\xE3o encontrada"};let i=Me(e,t);if(i.hit&&i.groups)return{success:!0,groups:i.groups};let s=t.length>6e3,a=s?Ye(e):Be(e,t);s&&console.warn(`\u26A0\uFE0F Diff muito grande (${t.length} chars), usando an\xE1lise baseada em nomes de arquivos`);let c=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${o.openai.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({model:o.openai.model,messages:[{role:"user",content:a}],max_tokens:800,temperature:.3})});if(!c.ok){let p=await c.json().catch(()=>({}));return{success:!1,error:`Erro da OpenAI (${c.status}): ${p.error?.message||"Erro desconhecido"}`}}let m=(await c.json()).choices?.[0]?.message?.content?.trim();if(!m)return{success:!1,error:"OpenAI retornou resposta vazia"};let u=m.match(/\{[\s\S]*\}/);if(!u)return{success:!1,error:"Resposta da OpenAI n\xE3o cont\xE9m JSON v\xE1lido"};let g=JSON.parse(u[0]);if(!g.groups||!Array.isArray(g.groups))return{success:!1,error:"Formato de resposta inv\xE1lido da OpenAI"};let h=g.groups.flatMap(p=>p.files||[]),M=e.filter(p=>!h.includes(p));M.length>0&&(g.groups[0].files=[...g.groups[0].files||[],...M]);let y=g.groups.map(p=>({id:p.id||`group-${Math.random().toString(36).substr(2,9)}`,name:p.name||"Grupo sem nome",description:p.description||"Sem descri\xE7\xE3o",files:p.files||[],diff:"",confidence:p.confidence||.5}));return ze(e,t,y),{success:!0,groups:y}}catch(i){return{success:!1,error:`Erro ao analisar contexto: ${i instanceof Error?i.message:"Erro desconhecido"}`}}}async function Ze(e){let{getFileDiff:t}=await Promise.resolve().then(()=>(S(),E)),o=e.files.map(s=>{try{let a=t(s),c=4e3;return a.length>c?a.substring(0,c)+`
|
|
86
|
+
... (diff truncado)`:a}catch{return""}}).filter(s=>s.length>0);if(o.length===0&&e.files.length>0){let{execSync:s}=await import("child_process"),a=e.files.filter(r=>{try{return s(`test -f "${r}"`,{stdio:"ignore"}),s(`git status --porcelain -- "${r}"`,{encoding:"utf-8",stdio:"pipe"}).trim().startsWith("??")}catch{return!1}});if(a.length>0)return a.map(r=>{try{let m=s(`cat "${r}"`,{encoding:"utf-8",stdio:"pipe"}),u=2e3,g=m.length>u?m.substring(0,u)+`
|
|
87
|
+
... (conte\xFAdo truncado)`:m;return`diff --git a/${r} b/${r}
|
|
146
88
|
new file mode 100644
|
|
147
89
|
index 0000000..${Math.random().toString(36).substr(2,7)}
|
|
148
90
|
--- /dev/null
|
|
149
|
-
+++ b/${
|
|
150
|
-
@@ -0,0 +1,${
|
|
91
|
+
+++ b/${r}
|
|
92
|
+
@@ -0,0 +1,${g.split(`
|
|
151
93
|
`).length} @@
|
|
152
|
-
${
|
|
153
|
-
`).map(
|
|
154
|
-
`)}`}catch{return""}}).filter(
|
|
155
|
-
`);let
|
|
156
|
-
`).includes(
|
|
157
|
-
... (conte\xFAdo truncado)`:
|
|
94
|
+
${g.split(`
|
|
95
|
+
`).map(h=>`+${h}`).join(`
|
|
96
|
+
`)}`}catch{return""}}).filter(r=>r.length>0).join(`
|
|
97
|
+
`);let c=e.files.filter(r=>{try{return s(`test -f "${r}"`,{stdio:"ignore"}),s("git diff --cached --name-only",{encoding:"utf-8",stdio:"pipe"}).trim().split(`
|
|
98
|
+
`).includes(r)}catch{return!1}});if(c.length>0)return c.map(r=>{try{let m=s(`cat "${r}"`,{encoding:"utf-8",stdio:"pipe"}),u=2e3,g=m.length>u?m.substring(0,u)+`
|
|
99
|
+
... (conte\xFAdo truncado)`:m;return`diff --git a/${r} b/${r}
|
|
158
100
|
index 0000000..${Math.random().toString(36).substr(2,7)} 100644
|
|
159
|
-
--- a/${
|
|
160
|
-
+++ b/${
|
|
161
|
-
@@ -1 +1,${
|
|
101
|
+
--- a/${r}
|
|
102
|
+
+++ b/${r}
|
|
103
|
+
@@ -1 +1,${g.split(`
|
|
162
104
|
`).length} @@
|
|
163
|
-
${
|
|
164
|
-
`).map(
|
|
165
|
-
`)}`}catch{return""}}).filter(
|
|
166
|
-
`)}let
|
|
167
|
-
`),
|
|
168
|
-
... (diff total truncado)`:
|
|
169
|
-
\
|
|
170
|
-
`);if(!
|
|
171
|
-
\
|
|
105
|
+
${g.split(`
|
|
106
|
+
`).map(h=>`+${h}`).join(`
|
|
107
|
+
`)}`}catch{return""}}).filter(r=>r.length>0).join(`
|
|
108
|
+
`)}let i=o.join(`
|
|
109
|
+
`),n=8e3;return i.length>n?i.substring(0,n)+`
|
|
110
|
+
... (diff total truncado)`:i}async function oe(e,t,o){o.silent||f.info("\u{1F9E0} Modo Smart Split ativado - Agrupando arquivos por contexto"),o.silent||f.info("\u{1F916} Analisando contexto das mudan\xE7as...");let i=await Qe(e.stagedFiles,e.diff,t);if(!i.success){o.silent||f.error(`\u274C Erro na an\xE1lise de contexto: ${i.error}`);return}if(!i.groups||i.groups.length===0){o.silent||f.error("\u274C Nenhum grupo foi criado pela an\xE1lise");return}if(o.silent||(f.success(`\u2705 ${i.groups.length} grupo(s) identificado(s):`),i.groups.forEach((n,s)=>{f.info(` ${s+1}. ${n.name} (${n.files.length} arquivo(s))`),f.info(` \u{1F4C4} ${n.files.join(", ")}`)})),!o.yes&&!o.silent){let{showSmartSplitGroups:n}=await Promise.resolve().then(()=>(ee(),we)),s=await n(i.groups);if(s.action==="cancel"){o.silent||f.info("\u274C Opera\xE7\xE3o cancelada pelo usu\xE1rio");return}if(s.action==="manual"){let a={...o,split:!0,smartSplit:!1},{main:c}=await Promise.resolve().then(()=>(se(),Fe));await c(a);return}}for(let n=0;n<i.groups.length;n++){let s=i.groups[n];if(!s){o.silent||f.error(`\u274C Grupo ${n+1} \xE9 undefined`);continue}o.silent||f.info(`
|
|
111
|
+
\u{1F504} Processando grupo ${n+1}/${i.groups.length}: ${s.name}`);let a=await Ze(s);if(!a){o.silent||(f.warn(`\u26A0\uFE0F Nenhum diff encontrado para o grupo: ${s.name}`),f.info(` \u{1F4C4} Arquivos: ${s.files.join(", ")}`),f.info(" \u{1F4A1} Poss\xEDvel causa: arquivos novos, deletados/recriados, ou sem mudan\xE7as"));continue}o.silent||f.info(`\u{1F916} Gerando commit para: ${s.name}`);let{generateWithRetry:c}=await Promise.resolve().then(()=>(W(),xe)),r=await c(a,t,s.files);if(!r.success){o.silent||f.error(`\u274C Erro ao gerar commit para ${s.name}: ${r.error}`);continue}if(!r.suggestion){o.silent||f.error(`\u274C Nenhuma sugest\xE3o gerada para ${s.name}`);continue}if(t.dryRun){o.silent||(f.info(`\u{1F50D} Dry Run - Grupo: ${s.name}`),f.info(`\u{1F4C4} Arquivos: ${s.files.join(", ")}`),f.info(`\u{1F4AD} Mensagem: "${r.suggestion.message}"`));continue}if(o.yes){let{executeFileCommit:m}=await Promise.resolve().then(()=>(S(),E)),u;if(s.files.length===1&&s.files[0])u=m(s.files[0],r.suggestion.message||"");else{let{execSync:g}=await import("child_process"),{escapeShellArg:h}=await Promise.resolve().then(()=>(S(),E));try{let M=s.files.map(x=>h(x)).join(" "),y=h(r.suggestion.message||"");g(`git commit ${M} -m ${y}`,{stdio:"pipe"}),u={success:!0,hash:g("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:r.suggestion.message||""}}catch(M){u={success:!1,error:M instanceof Error?M.message:"Erro desconhecido ao executar commit"}}}C(u.success,u.hash,u.error)}else{let{showCommitPreview:m,editCommitMessage:u,copyToClipboard:g,showCancellation:h}=await Promise.resolve().then(()=>(D(),Q));switch((await m(r.suggestion)).action){case"commit":{let{executeFileCommit:y}=await Promise.resolve().then(()=>(S(),E)),p,x=r.suggestion.message||"Atualiza\xE7\xE3o de arquivos";if(s.files.length===1&&s.files[0])p=y(s.files[0],x);else{let{execSync:I}=await import("child_process"),{escapeShellArg:O}=await Promise.resolve().then(()=>(S(),E));try{let v=s.files.map(H=>O(H)).join(" "),_=O(x);I(`git commit ${v} -m ${_}`,{stdio:"pipe"}),p={success:!0,hash:I("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:x}}catch(v){p={success:!1,error:v instanceof Error?v.message:"Erro desconhecido ao executar commit"}}}C(p.success,p.hash,p.error);break}case"edit":{let y=await u(r.suggestion.message);if(y.action==="commit"&&y.message){let{executeFileCommit:p}=await Promise.resolve().then(()=>(S(),E)),x;if(s.files.length===1&&s.files[0])x=p(s.files[0],y.message||"");else{let{execSync:I}=await import("child_process"),{escapeShellArg:O}=await Promise.resolve().then(()=>(S(),E));try{let v=s.files.map(H=>O(H)).join(" "),_=O(y.message||"");I(`git commit ${v} -m ${_}`,{stdio:"pipe"}),x={success:!0,hash:I("git rev-parse HEAD",{encoding:"utf-8",stdio:"pipe"}).trim(),message:y.message||""}}catch(v){x={success:!1,error:v instanceof Error?v.message:"Erro desconhecido ao executar commit"}}}C(x.success,x.hash,x.error)}break}case"copy":{await g(r.suggestion.message),o.silent||f.info("\u{1F3AF} Mensagem copiada para clipboard");break}case"cancel":{h();return}}}if(n<i.groups.length-1&&!o.yes){let{askContinueCommits:m}=await Promise.resolve().then(()=>(D(),Q)),u=i.groups.slice(n+1).filter(h=>h!==void 0).map(h=>h.name);if(!await m(u))break}}o.silent||f.success("\u2705 Smart Split conclu\xEDdo!")}var Re=b(()=>{"use strict";d();ie();D()});var Fe={};P(Fe,{main:()=>ne});import{log as l}from"@clack/prompts";async function ne(e={silent:!1,yes:!1,auto:!1,split:!1,smartSplit:!1,dryRun:!1,help:!1,version:!1}){e.silent||l.info("\u{1F680} Commit Wizard iniciado!"),V()||(l.error("\u274C N\xE3o foi encontrado um reposit\xF3rio Git neste diret\xF3rio."),e.silent||l.info("\u{1F4A1} Execute o comando em um diret\xF3rio com reposit\xF3rio Git inicializado."),process.exit(1)),e.silent||l.info("\u2699\uFE0F Carregando configura\xE7\xE3o...");let t=le();Ae(t),e.split&&(t.splitCommits=!0),e.dryRun&&(t.dryRun=!0);let o=ue(t);o.length>0&&(l.error("\u274C Erros na configura\xE7\xE3o:"),o.forEach(a=>l.error(` \u2022 ${a}`)),process.exit(1)),e.silent||l.success(`\u2705 Configura\xE7\xE3o carregada (modelo: ${t.openai.model}, idioma: ${t.language})`),e.silent||l.info("\u{1F4CB} Verificando arquivos staged...");let i=K();i.hasStaged||(l.warn("\u26A0\uFE0F Nenhum arquivo foi encontrado no stage."),e.silent||l.info("\u{1F4A1} Use `git add <arquivo>` para adicionar arquivos ao stage antes de gerar o commit."),process.exit(0));let n=J();if(e.silent||(l.success(`\u2705 Encontrados ${i.stagedFiles.length} arquivo(s) staged:`),i.stagedFiles.forEach(a=>l.info(` \u{1F4C4} ${a}`)),l.info(`\u{1F4CA} Estat\xEDsticas: +${n.added} -${n.removed} linhas`)),t.splitCommits||e.smartSplit){if(e.yes)return await oe(i,t,e);switch((await X()).action){case"proceed":return await oe(i,t,e);case"manual":return await Xe(i,t,e);case"cancel":G();return}}e.silent||l.info("\u{1F916} Gerando mensagem de commit com IA...");let s=await q(i.diff,t,i.stagedFiles);if(s.success||(l.error(`\u274C Erro ao gerar commit: ${s.error}`),process.exit(1)),s.suggestion||(l.error("\u274C Nenhuma sugest\xE3o foi gerada"),process.exit(1)),e.silent||l.success("\u2728 Mensagem de commit gerada!"),t.dryRun){l.info("\u{1F50D} Modo Dry Run - Mensagem gerada:"),l.info(`"${s.suggestion.message}"`),l.info("\u{1F4A1} Execute sem --dry-run para fazer o commit");return}if(e.yes){let a=z(s.suggestion.message);C(a.success,a.hash,a.error);return}for(;;)switch((await N(s.suggestion)).action){case"commit":{let c=z(s.suggestion.message);C(c.success,c.hash,c.error);return}case"edit":{let c=await L(s.suggestion.message);if(c.action==="cancel"){G();return}if(c.action==="commit"&&c.message){let r=z(c.message);C(r.success,r.hash,r.error);return}break}case"copy":{await U(s.suggestion.message),e.silent||l.info('\u{1F3AF} Voc\xEA pode usar a mensagem copiada com: git commit -m "mensagem"');return}case"cancel":{G();return}}}async function Xe(e,t,o){o.silent||l.info("\u{1F504} Modo Split ativado - Commits separados por arquivo");let i=[...e.stagedFiles];for(;i.length>0;){let n=o.yes?[i[0]]:await B(i);if(n.length===0){o.silent||l.info("\u274C Nenhum arquivo selecionado");break}let{getFileDiff:s}=await Promise.resolve().then(()=>(S(),E)),a=n.filter(r=>r!==void 0).map(r=>{try{return s(r)}catch(m){return l.error(`\u274C Erro ao obter diff do arquivo ${r}: ${m instanceof Error?m.message:"Erro desconhecido"}`),""}}).filter(r=>r.length>0).join(`
|
|
112
|
+
`);if(!a){o.silent||l.warn("\u26A0\uFE0F Nenhum diff encontrado para os arquivos selecionados"),i=i.filter(r=>!n.includes(r));continue}o.silent||l.info(`\u{1F916} Gerando commit para: ${n.join(", ")}`);let c=await q(a,t,n.filter(r=>r!==void 0));if(!c.success){l.error(`\u274C Erro ao gerar commit: ${c.error}`),i=i.filter(r=>!n.includes(r));continue}if(!c.suggestion){l.error("\u274C Nenhuma sugest\xE3o foi gerada"),i=i.filter(r=>!n.includes(r));continue}if(t.dryRun){l.info(`\u{1F50D} Dry Run - Mensagem para ${n.join(", ")}:`),l.info(`"${c.suggestion.message}"`),i=i.filter(r=>!n.includes(r));continue}if(o.yes){let r=n.length===1&&n[0]?await j(n[0],c.suggestion.message):await z(c.suggestion.message);C(r.success,r.hash,r.error)}else{let r=await N(c.suggestion);if(r.action==="commit"){let m=n.length===1&&n[0]?await j(n[0],c.suggestion.message):await z(c.suggestion.message);C(m.success,m.hash,m.error)}else if(r.action==="edit"){let m=await L(c.suggestion.message);if(m.action==="commit"&&m.message){let u=n.length===1&&n[0]?await j(n[0],m.message):await z(m.message);C(u.success,u.hash,u.error)}}else if(r.action==="copy")await U(c.suggestion.message),o.silent||l.info("\u{1F3AF} Mensagem copiada para clipboard");else if(r.action==="cancel"){G();return}}if(i=i.filter(r=>!n.includes(r)),i.length>0&&!o.yes&&!await Y(i))break}o.silent||l.success("\u2705 Modo Split conclu\xEDdo!")}var se=b(()=>{"use strict";d();pe();S();W();D();ee();Re();ie()});d();se();import{intro as et,outro as tt,log as it}from"@clack/prompts";d();function Ge(e){return{silent:e.includes("--silent")||e.includes("-s"),yes:e.includes("--yes")||e.includes("-y"),auto:e.includes("--auto")||e.includes("-a"),split:e.includes("--split"),smartSplit:e.includes("--smart-split"),dryRun:e.includes("--dry-run")||e.includes("-n"),help:e.includes("--help")||e.includes("-h"),version:e.includes("--version")||e.includes("-v")}}function Ie(){console.log(`
|
|
113
|
+
\u{1F9D9}\u200D\u2642\uFE0F Commit Wizard - Gerador inteligente de mensagens de commit
|
|
172
114
|
|
|
173
115
|
USAGE:
|
|
174
116
|
commit-wizard [OPTIONS]
|
|
@@ -192,4 +134,4 @@ EXAMPLES:
|
|
|
192
134
|
commit-wizard --auto # Modo totalmente autom\xE1tico
|
|
193
135
|
|
|
194
136
|
Para mais informa\xE7\xF5es, visite: https://github.com/user/commit-wizard
|
|
195
|
-
`)}function
|
|
137
|
+
`)}function Oe(){console.log("commit-wizard v1.0.0")}async function ot(){try{let e=Ge(process.argv.slice(2));e.help&&(Ie(),process.exit(0)),e.version&&(Oe(),process.exit(0)),e.auto&&(e.silent=!0,e.yes=!0),e.silent||et("\u{1F9D9}\u200D\u2642\uFE0F Commit Wizard"),await ne(e),e.silent||tt("At\xE9 logo! \u2728")}catch(e){it.error(`Erro: ${e instanceof Error?e.message:"Erro desconhecido"}`),process.exit(1)}}import.meta.url===`file://${process.argv[1]}`&&ot();
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Commit Wizard",
|
|
4
4
|
"publisher": "gilbert-oliveira",
|
|
5
5
|
"description": "CLI inteligente para gerar mensagens de commit usando OpenAI",
|
|
6
|
-
"version": "2.0
|
|
6
|
+
"version": "2.2.0",
|
|
7
7
|
"categories": [
|
|
8
8
|
"Other",
|
|
9
9
|
"SCM Providers"
|
|
@@ -15,26 +15,30 @@
|
|
|
15
15
|
"commit-wizard": "./dist/commit-wizard.js"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"dev": "
|
|
19
|
-
"build": "
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"test
|
|
23
|
-
"test:
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"ci
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"ci:
|
|
30
|
-
"ci:
|
|
18
|
+
"dev": "npm run build && node dist/commit-wizard.js",
|
|
19
|
+
"build": "tsup src/bin/commit-wizard.ts --format esm --dts --out-dir dist --clean --minify --splitting false --shims",
|
|
20
|
+
"build:tsc": "tsc --project tsconfig.json",
|
|
21
|
+
"start": "node dist/commit-wizard.js",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:coverage": "vitest run --coverage",
|
|
25
|
+
"test:integration": "vitest run tests/integration.test.ts",
|
|
26
|
+
"test:ci": "vitest run --coverage.enabled --coverage.reporter=lcov --reporter=junit --outputFile=coverage/test-report.junit.xml",
|
|
27
|
+
"lint": "eslint . --ext .ts",
|
|
28
|
+
"format": "prettier --write .",
|
|
29
|
+
"ci:test": "vitest run",
|
|
30
|
+
"ci:build": "npm run build",
|
|
31
|
+
"changeset": "changeset",
|
|
32
|
+
"version": "changeset version",
|
|
33
|
+
"release": "changeset publish",
|
|
34
|
+
"release:github": "npm run build && npm publish --registry=https://npm.pkg.github.com",
|
|
35
|
+
"canary": "npm run build && npm publish --tag canary",
|
|
36
|
+
"canary:github": "npm run build && npm publish --registry=https://npm.pkg.github.com --tag canary",
|
|
37
|
+
"changeset:create": "node scripts/create-changeset.js",
|
|
31
38
|
"release:patch": "./scripts/release.sh patch",
|
|
32
39
|
"release:minor": "./scripts/release.sh minor",
|
|
33
40
|
"release:major": "./scripts/release.sh major",
|
|
34
|
-
"check-changes": "node -e \"const { execSync } = require('child_process'); const changed = execSync('git diff --name-only HEAD~1 HEAD', { encoding: 'utf8' }).includes('package.json') || execSync('git diff --name-only HEAD~1 HEAD', { encoding: 'utf8' }).match(/(src|bin|scripts|dist)/\\.*/); console.log(changed ? '🚀 Mudanças detectadas - deploy recomendado!' : '⚠️ Nenhuma mudança significativa detectada'); process.exit(changed ? 0 : 1);\""
|
|
35
|
-
"type-check": "bun run tsc --noEmit",
|
|
36
|
-
"lint": "bun run eslint --fix",
|
|
37
|
-
"format": "bun run prettier --write ."
|
|
41
|
+
"check-changes": "node -e \"const { execSync } = require('child_process'); const changed = execSync('git diff --name-only HEAD~1 HEAD', { encoding: 'utf8' }).includes('package.json') || execSync('git diff --name-only HEAD~1 HEAD', { encoding: 'utf8' }).match(/(src|bin|scripts|dist)/\\.*/); console.log(changed ? '🚀 Mudanças detectadas - deploy recomendado!' : '⚠️ Nenhuma mudança significativa detectada'); process.exit(changed ? 0 : 1);\""
|
|
38
42
|
},
|
|
39
43
|
"keywords": [
|
|
40
44
|
"git",
|
|
@@ -47,22 +51,14 @@
|
|
|
47
51
|
],
|
|
48
52
|
"author": "Gilbert <contato@gilbert.dev.br>",
|
|
49
53
|
"license": "MIT",
|
|
50
|
-
"repository": {
|
|
51
|
-
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/gilbert-oliveira/commit-wizard.git"
|
|
53
|
-
},
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/gilbert-oliveira/commit-wizard/issues"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://github.com/gilbert-oliveira/commit-wizard#readme",
|
|
58
54
|
"engines": {
|
|
59
|
-
"node": ">=18.0.0"
|
|
60
|
-
"bun": ">=1.0.0"
|
|
55
|
+
"node": ">=18.0.0"
|
|
61
56
|
},
|
|
62
57
|
"files": [
|
|
63
58
|
"bin/",
|
|
64
59
|
"src/",
|
|
65
60
|
"dist/",
|
|
61
|
+
"dist-node/",
|
|
66
62
|
"README.md",
|
|
67
63
|
"LICENSE",
|
|
68
64
|
".commit-wizardrc"
|
|
@@ -70,24 +66,41 @@
|
|
|
70
66
|
"dependencies": {
|
|
71
67
|
"@clack/prompts": "^0.11.0",
|
|
72
68
|
"clipboardy": "^4.0.0",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
69
|
+
"dotenv": "^17.2.0",
|
|
70
|
+
"simple-git": "^3.25.0"
|
|
75
71
|
},
|
|
76
72
|
"devDependencies": {
|
|
77
|
-
"@
|
|
73
|
+
"@changesets/cli": "^2.29.5",
|
|
74
|
+
"@types/jest": "^30.0.0",
|
|
78
75
|
"@types/node": "^24.0.13",
|
|
79
76
|
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
80
77
|
"@typescript-eslint/parser": "^8.36.0",
|
|
81
|
-
"
|
|
78
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
79
|
+
"@vitest/ui": "^3.2.4",
|
|
82
80
|
"chalk": "^5.3.0",
|
|
83
81
|
"eslint": "^9.30.1",
|
|
84
|
-
"
|
|
82
|
+
"jest": "^30.0.4",
|
|
83
|
+
"prettier": "^3.6.2",
|
|
84
|
+
"ts-jest": "^29.4.0",
|
|
85
|
+
"ts-node": "^10.9.2",
|
|
86
|
+
"tsconfig-paths": "^4.2.0",
|
|
87
|
+
"tsup": "^8.5.0",
|
|
88
|
+
"vitest": "^3.2.4"
|
|
85
89
|
},
|
|
86
90
|
"peerDependencies": {
|
|
87
91
|
"typescript": "^5"
|
|
88
92
|
},
|
|
89
93
|
"preferGlobal": true,
|
|
90
94
|
"publishConfig": {
|
|
91
|
-
"access": "public"
|
|
92
|
-
|
|
95
|
+
"access": "public",
|
|
96
|
+
"registry": "https://registry.npmjs.org/"
|
|
97
|
+
},
|
|
98
|
+
"repository": {
|
|
99
|
+
"type": "git",
|
|
100
|
+
"url": "git+https://github.com/gilbert-oliveira/commit-wizard.git"
|
|
101
|
+
},
|
|
102
|
+
"bugs": {
|
|
103
|
+
"url": "https://github.com/gilbert-oliveira/commit-wizard/issues"
|
|
104
|
+
},
|
|
105
|
+
"homepage": "https://github.com/gilbert-oliveira/commit-wizard#readme"
|
|
93
106
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { intro, outro, log } from '@clack/prompts';
|
|
4
|
-
import { main } from '
|
|
5
|
-
import { parseArgs, showHelp, showVersion } from '../
|
|
4
|
+
import { main } from '@core/index';
|
|
5
|
+
import { parseArgs, showHelp, showVersion } from '../utils/args';
|
|
6
6
|
|
|
7
7
|
async function run() {
|
|
8
8
|
try {
|
|
@@ -46,6 +46,7 @@ async function run() {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
// Verificar se o arquivo está sendo executado diretamente
|
|
50
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
50
51
|
run();
|
|
51
|
-
}
|
|
52
|
+
}
|
package/src/config/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'fs';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
import dotenv from 'dotenv';
|
|
4
|
+
// Removido: import dotenv from 'dotenv';
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
dotenv.config();
|
|
6
|
+
// Removido: dotenv.config();
|
|
8
7
|
|
|
9
8
|
export interface Config {
|
|
10
9
|
openai: {
|
package/src/core/cache.ts
CHANGED
package/src/core/index.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { log } from '@clack/prompts';
|
|
2
|
-
import { loadConfig, validateConfig } from '../config/index
|
|
2
|
+
import { loadConfig, validateConfig } from '../config/index';
|
|
3
3
|
import {
|
|
4
4
|
isGitRepository,
|
|
5
5
|
getGitStatus,
|
|
6
6
|
getDiffStats,
|
|
7
7
|
executeCommit,
|
|
8
8
|
executeFileCommit,
|
|
9
|
-
} from '../git/index
|
|
10
|
-
import { generateWithRetry } from './openai
|
|
9
|
+
} from '../git/index';
|
|
10
|
+
import { generateWithRetry } from './openai';
|
|
11
11
|
import {
|
|
12
12
|
showCommitPreview,
|
|
13
13
|
editCommitMessage,
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
showCancellation,
|
|
17
17
|
selectFilesForCommit,
|
|
18
18
|
askContinueCommits,
|
|
19
|
-
} from '../ui/index
|
|
20
|
-
import { chooseSplitMode } from '../ui/smart-split
|
|
21
|
-
import { handleSmartSplitMode } from './smart-split
|
|
22
|
-
import { initializeCache } from './cache
|
|
23
|
-
import type { CLIArgs } from '../utils/args
|
|
24
|
-
import type { Config } from '../config/index
|
|
19
|
+
} from '../ui/index';
|
|
20
|
+
import { chooseSplitMode } from '../ui/smart-split';
|
|
21
|
+
import { handleSmartSplitMode } from './smart-split';
|
|
22
|
+
import { initializeCache } from './cache';
|
|
23
|
+
import type { CLIArgs } from '../utils/args';
|
|
24
|
+
import type { Config } from '../config/index';
|
|
25
25
|
|
|
26
26
|
export async function main(
|
|
27
27
|
args: CLIArgs = {
|
|
@@ -248,7 +248,7 @@ async function handleSplitMode(gitStatus: any, config: any, args: CLIArgs) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// Gerar diff apenas dos arquivos selecionados
|
|
251
|
-
const { getFileDiff } = await import('../git/index
|
|
251
|
+
const { getFileDiff } = await import('../git/index');
|
|
252
252
|
const fileDiffs = selectedFiles
|
|
253
253
|
.filter((file): file is string => file !== undefined)
|
|
254
254
|
.map((file) => {
|
package/src/core/openai.ts
CHANGED
package/src/core/smart-split.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Config } from '../config/index
|
|
2
|
-
import type { CLIArgs } from '../utils/args
|
|
3
|
-
import { getCachedAnalysis, setCachedAnalysis } from './cache
|
|
4
|
-
import { showCommitResult } from '../ui/index
|
|
1
|
+
import type { Config } from '../config/index';
|
|
2
|
+
import type { CLIArgs } from '../utils/args';
|
|
3
|
+
import { getCachedAnalysis, setCachedAnalysis } from './cache';
|
|
4
|
+
import { showCommitResult } from '../ui/index';
|
|
5
5
|
import { log } from '@clack/prompts';
|
|
6
6
|
|
|
7
7
|
export interface FileGroup {
|
|
@@ -251,7 +251,7 @@ export async function analyzeFileContext(
|
|
|
251
251
|
* Gera diff para um grupo de arquivos (otimizado para tokens)
|
|
252
252
|
*/
|
|
253
253
|
export async function generateGroupDiff(group: FileGroup): Promise<string> {
|
|
254
|
-
const { getFileDiff } = await import('../git/index
|
|
254
|
+
const { getFileDiff } = await import('../git/index');
|
|
255
255
|
|
|
256
256
|
const diffs = group.files
|
|
257
257
|
.map((file) => {
|
|
@@ -429,7 +429,7 @@ export async function handleSmartSplitMode(
|
|
|
429
429
|
|
|
430
430
|
// Mostrar interface de Smart Split para o usuário decidir
|
|
431
431
|
if (!args.yes && !args.silent) {
|
|
432
|
-
const { showSmartSplitGroups } = await import('../ui/smart-split
|
|
432
|
+
const { showSmartSplitGroups } = await import('../ui/smart-split');
|
|
433
433
|
const userAction = await showSmartSplitGroups(analysis.groups);
|
|
434
434
|
|
|
435
435
|
if (userAction.action === 'cancel') {
|
|
@@ -442,7 +442,7 @@ export async function handleSmartSplitMode(
|
|
|
442
442
|
if (userAction.action === 'manual') {
|
|
443
443
|
// Delegar para modo manual - re-executar com flag split
|
|
444
444
|
const newArgs = { ...args, split: true, smartSplit: false };
|
|
445
|
-
const { main } = await import('./index
|
|
445
|
+
const { main } = await import('./index');
|
|
446
446
|
await main(newArgs);
|
|
447
447
|
return;
|
|
448
448
|
}
|
|
@@ -486,7 +486,7 @@ export async function handleSmartSplitMode(
|
|
|
486
486
|
log.info(`🤖 Gerando commit para: ${group.name}`);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
const { generateWithRetry } = await import('./openai
|
|
489
|
+
const { generateWithRetry } = await import('./openai');
|
|
490
490
|
const result = await generateWithRetry(groupDiff, config, group.files);
|
|
491
491
|
|
|
492
492
|
if (!result.success) {
|
|
@@ -518,7 +518,7 @@ export async function handleSmartSplitMode(
|
|
|
518
518
|
// Interface do usuário
|
|
519
519
|
if (args.yes) {
|
|
520
520
|
// Modo automático
|
|
521
|
-
const { executeFileCommit } = await import('../git/index
|
|
521
|
+
const { executeFileCommit } = await import('../git/index');
|
|
522
522
|
let commitResult;
|
|
523
523
|
|
|
524
524
|
// Fazer commit apenas dos arquivos do grupo atual
|
|
@@ -531,7 +531,7 @@ export async function handleSmartSplitMode(
|
|
|
531
531
|
// Para múltiplos arquivos, usar commit normal mas com apenas os arquivos do grupo
|
|
532
532
|
const { execSync } = await import('child_process');
|
|
533
533
|
// Importar função de escape do módulo git
|
|
534
|
-
const { escapeShellArg } = await import('../git/index
|
|
534
|
+
const { escapeShellArg } = await import('../git/index');
|
|
535
535
|
try {
|
|
536
536
|
// Fazer commit apenas dos arquivos do grupo
|
|
537
537
|
const filesArg = group.files.map((f) => escapeShellArg(f)).join(' ');
|
|
@@ -576,13 +576,13 @@ export async function handleSmartSplitMode(
|
|
|
576
576
|
editCommitMessage,
|
|
577
577
|
copyToClipboard,
|
|
578
578
|
showCancellation,
|
|
579
|
-
} = await import('../ui/index
|
|
579
|
+
} = await import('../ui/index');
|
|
580
580
|
|
|
581
581
|
const uiAction = await showCommitPreview(result.suggestion);
|
|
582
582
|
|
|
583
583
|
switch (uiAction.action) {
|
|
584
584
|
case 'commit': {
|
|
585
|
-
const { executeFileCommit } = await import('../git/index
|
|
585
|
+
const { executeFileCommit } = await import('../git/index');
|
|
586
586
|
let commitResult;
|
|
587
587
|
|
|
588
588
|
// Fazer commit apenas dos arquivos do grupo atual
|
|
@@ -594,7 +594,7 @@ export async function handleSmartSplitMode(
|
|
|
594
594
|
// Para múltiplos arquivos, usar commit normal mas com apenas os arquivos do grupo
|
|
595
595
|
const { execSync } = await import('child_process');
|
|
596
596
|
// Importar função de escape do módulo git
|
|
597
|
-
const { escapeShellArg } = await import('../git/index
|
|
597
|
+
const { escapeShellArg } = await import('../git/index');
|
|
598
598
|
try {
|
|
599
599
|
// Fazer commit apenas dos arquivos do grupo
|
|
600
600
|
const filesArg = group.files.map((f) => escapeShellArg(f)).join(' ');
|
|
@@ -633,7 +633,7 @@ export async function handleSmartSplitMode(
|
|
|
633
633
|
case 'edit': {
|
|
634
634
|
const editAction = await editCommitMessage(result.suggestion.message);
|
|
635
635
|
if (editAction.action === 'commit' && editAction.message) {
|
|
636
|
-
const { executeFileCommit } = await import('../git/index
|
|
636
|
+
const { executeFileCommit } = await import('../git/index');
|
|
637
637
|
let editCommitResult;
|
|
638
638
|
|
|
639
639
|
// Fazer commit apenas dos arquivos do grupo atual
|
|
@@ -646,7 +646,7 @@ export async function handleSmartSplitMode(
|
|
|
646
646
|
// Para múltiplos arquivos, usar commit normal mas com apenas os arquivos do grupo
|
|
647
647
|
const { execSync } = await import('child_process');
|
|
648
648
|
// Importar função de escape do módulo git
|
|
649
|
-
const { escapeShellArg } = await import('../git/index
|
|
649
|
+
const { escapeShellArg } = await import('../git/index');
|
|
650
650
|
try {
|
|
651
651
|
// Fazer commit apenas dos arquivos do grupo
|
|
652
652
|
const filesArg = group.files.map((f) => escapeShellArg(f)).join(' ');
|
|
@@ -703,7 +703,7 @@ export async function handleSmartSplitMode(
|
|
|
703
703
|
|
|
704
704
|
// Perguntar se quer continuar (exceto em modo automático)
|
|
705
705
|
if (i < analysis.groups.length - 1 && !args.yes) {
|
|
706
|
-
const { askContinueCommits } = await import('../ui/index
|
|
706
|
+
const { askContinueCommits } = await import('../ui/index');
|
|
707
707
|
const remainingGroups = analysis.groups
|
|
708
708
|
.slice(i + 1)
|
|
709
709
|
.filter((g) => g !== undefined)
|
package/src/ui/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isCancel,
|
|
9
9
|
} from '@clack/prompts';
|
|
10
10
|
import clipboardy from 'clipboardy';
|
|
11
|
-
import type { CommitSuggestion } from '../core/openai
|
|
11
|
+
import type { CommitSuggestion } from '../core/openai';
|
|
12
12
|
|
|
13
13
|
export interface UIAction {
|
|
14
14
|
action: 'commit' | 'edit' | 'copy' | 'cancel';
|
package/src/ui/smart-split.ts
CHANGED
package/src/utils/polyfill.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Polyfill para stripVTControlCharacters para compatibilidade com Bun/Node.js
|
|
3
|
-
*
|
|
4
|
-
* Este polyfill resolve problemas de compatibilidade onde o Bun não mapeia
|
|
5
|
-
* corretamente a função stripVTControlCharacters do módulo util do Node.js.
|
|
6
|
-
* A função foi adicionada ao Node.js v16.14.0+ mas pode não estar disponível
|
|
7
|
-
* em todos os ambientes ou ter problemas de mapping no Bun.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Remove caracteres de controle VT de uma string
|
|
12
|
-
* Implementação baseada na função nativa do Node.js
|
|
13
|
-
*
|
|
14
|
-
* @param str - String da qual remover os caracteres de controle
|
|
15
|
-
* @returns String limpa sem caracteres de controle VT/ANSI
|
|
16
|
-
*/
|
|
17
|
-
function stripVTControlCharacters(str: string): string {
|
|
18
|
-
if (typeof str !== 'string') {
|
|
19
|
-
throw new TypeError('The "str" argument must be of type string');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Regex para caracteres de controle ANSI/VT
|
|
23
|
-
// Baseada na implementação oficial do Node.js
|
|
24
|
-
const esc = String.fromCharCode(27); // ESC character (\u001B)
|
|
25
|
-
const csi = String.fromCharCode(155); // CSI character (\u009B)
|
|
26
|
-
const ansiRegex = new RegExp(
|
|
27
|
-
`[${esc}${csi}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`,
|
|
28
|
-
'g'
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
return str.replace(ansiRegex, '');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Interceptar require/import do módulo util antes de qualquer outra coisa
|
|
35
|
-
|
|
36
|
-
const Module = require('module');
|
|
37
|
-
const originalRequire = Module.prototype.require;
|
|
38
|
-
|
|
39
|
-
Module.prototype.require = function (id: string) {
|
|
40
|
-
const result = originalRequire.apply(this, arguments);
|
|
41
|
-
|
|
42
|
-
// Se estiver importando o módulo util e stripVTControlCharacters não existe, adicionar
|
|
43
|
-
if (id === 'util' && result && !result.stripVTControlCharacters) {
|
|
44
|
-
result.stripVTControlCharacters = stripVTControlCharacters;
|
|
45
|
-
// Tornar a propriedade não enumerável para não interferir em iterações
|
|
46
|
-
Object.defineProperty(result, 'stripVTControlCharacters', {
|
|
47
|
-
value: stripVTControlCharacters,
|
|
48
|
-
writable: false,
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: false,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return result;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
declare global {
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
59
|
-
namespace NodeJS {
|
|
60
|
-
interface Global {
|
|
61
|
-
stripVTControlCharacters?: typeof stripVTControlCharacters;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Disponibilizar globalmente também como fallback
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
typeof globalThis !== 'undefined' &&
|
|
70
|
-
!(globalThis as any).stripVTControlCharacters
|
|
71
|
-
) {
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
-
(globalThis as any).stripVTControlCharacters = stripVTControlCharacters;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Tentar aplicar diretamente ao módulo util se possível
|
|
77
|
-
try {
|
|
78
|
-
const util = require('util');
|
|
79
|
-
if (!util.stripVTControlCharacters) {
|
|
80
|
-
util.stripVTControlCharacters = stripVTControlCharacters;
|
|
81
|
-
}
|
|
82
|
-
} catch {
|
|
83
|
-
// Ignorar se não conseguir aplicar
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export { stripVTControlCharacters };
|