@notyped/gitai 0.0.12 → 1.0.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 +28 -34
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,13 @@ Click the image below to watch the video tutorial about Gitai:
|
|
|
27
27
|
|
|
28
28
|
[](https://www.youtube.com/watch?v=GAQ4mmGxg7c "AUTOMATED GIT COMMITS WITH AI: GITAI (OPEN SOURCE AND FREE)")
|
|
29
29
|
|
|
30
|
+
## 📋 Prerequisites
|
|
31
|
+
|
|
32
|
+
Before installing Gitai, ensure you have:
|
|
33
|
+
|
|
34
|
+
- **Node.js 18 or higher** - [Download here](https://nodejs.org/)
|
|
35
|
+
- **Git** - [Download here](https://git-scm.com/)
|
|
36
|
+
|
|
30
37
|
## ⚡ Installing the Application
|
|
31
38
|
|
|
32
39
|
Gitai can be installed globally via npm, making it available across all your projects:
|
|
@@ -53,34 +60,24 @@ Below is detailed information about each provider to help you choose the best on
|
|
|
53
60
|
|
|
54
61
|
OpenAI is a paid service that offers advanced language models.
|
|
55
62
|
|
|
56
|
-
The most efficient available model is `gpt-
|
|
63
|
+
The most efficient available model is `gpt-5.2`, which has a context window of 400K tokens.
|
|
57
64
|
|
|
58
|
-
- **Cost**:
|
|
59
|
-
- $2.50 per 1M tokens for Input
|
|
60
|
-
- $10.00 per 1M tokens for Output
|
|
61
65
|
- **Website**: [OpenAI](https://platform.openai.com/docs/introduction)
|
|
62
66
|
|
|
63
67
|
### Groq
|
|
64
68
|
|
|
65
69
|
Groq is a free service, but with usage limits.
|
|
66
70
|
|
|
67
|
-
The recommended model is `
|
|
71
|
+
The recommended model is `llama-3.3-70b-versatile`, which offers a context window of 131,072 tokens.
|
|
68
72
|
|
|
69
|
-
- **Usage Limits**:
|
|
70
|
-
- **Requests per Minute**: 30
|
|
71
|
-
- **Requests per Day**: 14,400
|
|
72
|
-
- **Tokens per Minute**: 5,000
|
|
73
73
|
- **Website**: [Groq](https://console.groq.com/)
|
|
74
74
|
|
|
75
75
|
### Anthropic
|
|
76
76
|
|
|
77
77
|
Anthropic is a paid service that offers advanced AI models with excellent reasoning capabilities.
|
|
78
78
|
|
|
79
|
-
The recommended model is `claude-
|
|
79
|
+
The recommended model is `claude-sonnet-4-5-20250929`, which has a context window of 200K tokens.
|
|
80
80
|
|
|
81
|
-
- **Cost**:
|
|
82
|
-
- $3.00 per 1M tokens for Input
|
|
83
|
-
- $15.00 per 1M tokens for Output
|
|
84
81
|
- **Features**: Advanced reasoning, large context window, excellent code understanding
|
|
85
82
|
- **Website**: [Anthropic](https://console.anthropic.com/)
|
|
86
83
|
|
|
@@ -97,7 +94,7 @@ The wizard will guide you through:
|
|
|
97
94
|
1. **Language Selection**: Choose your preferred language (English, Portuguese, Spanish, etc.)
|
|
98
95
|
2. **Provider Selection**: Choose between OpenAI, Groq, or Anthropic
|
|
99
96
|
3. **API Key**: Enter your API key for the selected provider
|
|
100
|
-
4. **Model Selection**: Choose the AI model to use (e.g., `gpt-
|
|
97
|
+
4. **Model Selection**: Choose the AI model to use (e.g., `gpt-5.2`, `llama-3.3-70b-versatile`, `claude-sonnet-4-5-20250929`)
|
|
101
98
|
|
|
102
99
|
Your configuration is saved globally in `~/.gitai`, so you don't need to configure it for every project.
|
|
103
100
|
|
|
@@ -106,7 +103,7 @@ Your configuration is saved globally in `~/.gitai`, so you don't need to configu
|
|
|
106
103
|
```dotenv
|
|
107
104
|
PROVIDER=openai
|
|
108
105
|
API_KEY=your_openai_api_key
|
|
109
|
-
MODEL=gpt-
|
|
106
|
+
MODEL=gpt-5.2
|
|
110
107
|
LANGUAGE=en
|
|
111
108
|
```
|
|
112
109
|
|
|
@@ -115,7 +112,7 @@ LANGUAGE=en
|
|
|
115
112
|
```dotenv
|
|
116
113
|
PROVIDER=groq
|
|
117
114
|
API_KEY=your_groq_api_key
|
|
118
|
-
MODEL=
|
|
115
|
+
MODEL=llama-3.3-70b-versatile
|
|
119
116
|
LANGUAGE=en
|
|
120
117
|
```
|
|
121
118
|
|
|
@@ -124,7 +121,7 @@ LANGUAGE=en
|
|
|
124
121
|
```dotenv
|
|
125
122
|
PROVIDER=anthropic
|
|
126
123
|
API_KEY=your_anthropic_api_key
|
|
127
|
-
MODEL=claude-
|
|
124
|
+
MODEL=claude-sonnet-4-5-20250929
|
|
128
125
|
LANGUAGE=en
|
|
129
126
|
```
|
|
130
127
|
|
|
@@ -300,6 +297,13 @@ Clique na imagem abaixo para assistir ao tutorial em vídeo sobre o Gitai:
|
|
|
300
297
|
|
|
301
298
|
[](https://www.youtube.com/watch?v=GAQ4mmGxg7c "AUTOMATIZAÇÃO DE COMMITS DO GIT COM IA: GITAI (OPEN SOURCE E GRATUITO)")
|
|
302
299
|
|
|
300
|
+
## 📋 Pré-requisitos
|
|
301
|
+
|
|
302
|
+
Antes de instalar o Gitai, certifique-se de ter:
|
|
303
|
+
|
|
304
|
+
- **Node.js 18 ou superior** - [Baixe aqui](https://nodejs.org/)
|
|
305
|
+
- **Git** - [Baixe aqui](https://git-scm.com/)
|
|
306
|
+
|
|
303
307
|
## ⚡ Instalando a Aplicação
|
|
304
308
|
|
|
305
309
|
O Gitai pode ser instalado globalmente via npm, tornando-o disponível em todos os seus projetos:
|
|
@@ -326,34 +330,24 @@ Abaixo estão as informações detalhadas sobre cada provedor para ajudá-lo a e
|
|
|
326
330
|
|
|
327
331
|
OpenAI é um serviço pago que oferece modelos de linguagem avançados.
|
|
328
332
|
|
|
329
|
-
O modelo mais eficiente disponível é o `gpt-
|
|
333
|
+
O modelo mais eficiente disponível é o `gpt-5.2`, que tem uma janela de contexto de 400K tokens.
|
|
330
334
|
|
|
331
|
-
- **Custo**:
|
|
332
|
-
- $2.50 por 1M tokens para Input
|
|
333
|
-
- $10.00 por 1M tokens para Output
|
|
334
335
|
- **Site**: [OpenAI](https://platform.openai.com/docs/introduction)
|
|
335
336
|
|
|
336
337
|
### Groq
|
|
337
338
|
|
|
338
339
|
Groq é um serviço gratuito, mas com limites de utilização.
|
|
339
340
|
|
|
340
|
-
O modelo recomendado é o `
|
|
341
|
+
O modelo recomendado é o `llama-3.3-70b-versatile`, que oferece uma janela de contexto de 131,072 tokens.
|
|
341
342
|
|
|
342
|
-
- **Limites de Utilização**:
|
|
343
|
-
- **Requests por Minuto**: 30
|
|
344
|
-
- **Requests por Dia**: 14,400
|
|
345
|
-
- **Tokens por Minuto**: 5,000
|
|
346
343
|
- **Site**: [Groq](https://console.groq.com/)
|
|
347
344
|
|
|
348
345
|
### Anthropic
|
|
349
346
|
|
|
350
347
|
Anthropic é um serviço pago que oferece modelos de IA avançados com excelentes capacidades de raciocínio.
|
|
351
348
|
|
|
352
|
-
O modelo recomendado é o `claude-
|
|
349
|
+
O modelo recomendado é o `claude-sonnet-4-5-20250929`, que tem uma janela de contexto de 200K tokens.
|
|
353
350
|
|
|
354
|
-
- **Custo**:
|
|
355
|
-
- $3.00 por 1M tokens para Input
|
|
356
|
-
- $15.00 por 1M tokens para Output
|
|
357
351
|
- **Características**: Raciocínio avançado, grande janela de contexto, excelente compreensão de código
|
|
358
352
|
- **Site**: [Anthropic](https://console.anthropic.com/)
|
|
359
353
|
|
|
@@ -370,7 +364,7 @@ O assistente irá guiá-lo através de:
|
|
|
370
364
|
1. **Seleção de Idioma**: Escolha seu idioma preferido (Inglês, Português, Espanhol, etc.)
|
|
371
365
|
2. **Seleção de Provedor**: Escolha entre OpenAI, Groq ou Anthropic
|
|
372
366
|
3. **Chave de API**: Insira sua chave de API para o provedor selecionado
|
|
373
|
-
4. **Seleção de Modelo**: Escolha o modelo de IA a ser usado (ex: `gpt-
|
|
367
|
+
4. **Seleção de Modelo**: Escolha o modelo de IA a ser usado (ex: `gpt-5.2`, `llama-3.3-70b-versatile`, `claude-sonnet-4-5-20250929`)
|
|
374
368
|
|
|
375
369
|
Sua configuração é salva globalmente em `~/.gitai`, então você não precisa configurá-la para cada projeto.
|
|
376
370
|
|
|
@@ -379,7 +373,7 @@ Sua configuração é salva globalmente em `~/.gitai`, então você não precisa
|
|
|
379
373
|
```dotenv
|
|
380
374
|
PROVIDER=openai
|
|
381
375
|
API_KEY=your_openai_api_key
|
|
382
|
-
MODEL=gpt-
|
|
376
|
+
MODEL=gpt-5.2
|
|
383
377
|
LANGUAGE=en
|
|
384
378
|
```
|
|
385
379
|
|
|
@@ -388,7 +382,7 @@ LANGUAGE=en
|
|
|
388
382
|
```dotenv
|
|
389
383
|
PROVIDER=groq
|
|
390
384
|
API_KEY=your_groq_api_key
|
|
391
|
-
MODEL=
|
|
385
|
+
MODEL=llama-3.3-70b-versatile
|
|
392
386
|
LANGUAGE=en
|
|
393
387
|
```
|
|
394
388
|
|
|
@@ -397,7 +391,7 @@ LANGUAGE=en
|
|
|
397
391
|
```dotenv
|
|
398
392
|
PROVIDER=anthropic
|
|
399
393
|
API_KEY=your_anthropic_api_key
|
|
400
|
-
MODEL=claude-
|
|
394
|
+
MODEL=claude-sonnet-4-5-20250929
|
|
401
395
|
LANGUAGE=en
|
|
402
396
|
```
|
|
403
397
|
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ Important rules:
|
|
|
113
113
|
- Remember to follow the provided template.
|
|
114
114
|
|
|
115
115
|
If the instructions are not followed correctly, the result will not be accepted.
|
|
116
|
-
`.trim();return this.callApi(n,r)}async callApi(o,i){if(this.config.provider==="openai"&&this.openai){s.ai(`Provider: openai - Model: ${this.config.model}`);let n=["o1","o3","gpt-5"].some(v=>this.config.model.startsWith(v))?"max_completion_tokens":"max_tokens";return(await this.openai.chat.completions.create({messages:[{role:"system",content:o},{role:"user",content:i}],model:this.config.model,temperature:.5,top_p:1,frequency_penalty:0,presence_penalty:0,[n]:500})).choices[0].message.content?.trim()||""}else{if(this.config.provider==="groq"&&this.groq)return s.ai(`Provider: groq - Model: ${this.config.model}`),(await this.groq.chat.completions.create({messages:[{role:"system",content:o},{role:"user",content:i}],model:this.config.model,temperature:.5,max_tokens:500,top_p:1,frequency_penalty:0,presence_penalty:0})).choices[0].message.content?.trim()||"";if(this.config.provider==="anthropic"&&this.anthropic){s.ai(`Provider: anthropic - Model: ${this.config.model}`);let n=(await this.anthropic.messages.create({model:this.config.model,max_tokens:500,temperature:.5,system:o,messages:[{role:"user",content:i}]})).content[0];return n.type==="text"?n.text.trim():""}}return""}};import C from"fs";import _ from"os";import Y from"path";import q from"semver";var d="0.0
|
|
116
|
+
`.trim();return this.callApi(n,r)}async callApi(o,i){if(this.config.provider==="openai"&&this.openai){s.ai(`Provider: openai - Model: ${this.config.model}`);let n=["o1","o3","gpt-5"].some(v=>this.config.model.startsWith(v))?"max_completion_tokens":"max_tokens";return(await this.openai.chat.completions.create({messages:[{role:"system",content:o},{role:"user",content:i}],model:this.config.model,temperature:.5,top_p:1,frequency_penalty:0,presence_penalty:0,[n]:500})).choices[0].message.content?.trim()||""}else{if(this.config.provider==="groq"&&this.groq)return s.ai(`Provider: groq - Model: ${this.config.model}`),(await this.groq.chat.completions.create({messages:[{role:"system",content:o},{role:"user",content:i}],model:this.config.model,temperature:.5,max_tokens:500,top_p:1,frequency_penalty:0,presence_penalty:0})).choices[0].message.content?.trim()||"";if(this.config.provider==="anthropic"&&this.anthropic){s.ai(`Provider: anthropic - Model: ${this.config.model}`);let n=(await this.anthropic.messages.create({model:this.config.model,max_tokens:500,temperature:.5,system:o,messages:[{role:"user",content:i}]})).content[0];return n.type==="text"?n.text.trim():""}}return""}};import C from"fs";import _ from"os";import Y from"path";import q from"semver";var d="1.0.0",j="gitai",b={node:">=18"};var u=Y.join(_.homedir(),".gitai"),P=()=>{try{return C.existsSync(u)}catch{return!1}},E=()=>{if(!P())throw new Error(`Configuration file not found at ${u}`);let e=C.readFileSync(u,"utf-8"),o={};return e.split(`
|
|
117
117
|
`).forEach(i=>{let[t,...n]=i.split("=");if(t&&n&&t.trim()){let r=n.join("=").trim();r.startsWith('"')&&r.endsWith('"')&&(r=r.slice(1,-1)),r.startsWith("'")&&r.endsWith("'")&&(r=r.slice(1,-1)),o[t.trim()]=r}}),o},$=e=>{let o=Object.entries(e).map(([i,t])=>`${i}=${t}`).join(`
|
|
118
118
|
`);C.writeFileSync(u,o,{mode:384})},R=()=>{let e=b.node;return q.satisfies(process.version,e)};import{execa as K}from"execa";import N from"fs/promises";import U from"os";import B from"path";async function l(e,o=process.cwd(),i=!0){try{let t=await K("git",e,{cwd:o,reject:!1});return t.exitCode!==0&&i&&(s.error(`Error executing command: git ${e.join(" ")}`),s.error(`Standard output: ${t.stdout}`),s.error(`Error output: ${t.stderr}`),process.exit(1)),{stdout:t.stdout.trim(),stderr:t.stderr.trim(),exitCode:t.exitCode??1}}catch(t){if(i){let r=t instanceof Error?t.message:String(t);s.error(`Unexpected error executing git command: ${r}`),process.exit(1)}return{stdout:"",stderr:t instanceof Error?t.message:String(t),exitCode:1}}}async function A(e){let{stdout:o}=await l(["status","--porcelain"],e);return o.length>0}async function T(e){let{stdout:o}=await l(["status","-uno"],e);return o.includes("Your branch is ahead")||o.includes("Seu branch est\xE1 \xE0 frente")}async function L(e){let{stdout:o,stderr:i,exitCode:t}=await l(["pull"],e,!1);if(t!==0){if(o.includes("CONFLICT")||o.includes("CONFLITO")||i.includes("CONFLICT")||i.includes("CONFLITO"))return s.warning("Conflitos detectados durante git pull:"),s.error(o||i),!1;s.error(`Error executing git pull: ${o||i}`),process.exit(1)}return s.success("Git pull executed successfully."),!0}async function O(e,o){await l(["add","."],o);let i=U.tmpdir(),t=B.join(i,`gitai_commit_${Date.now()}.txt`);try{await N.writeFile(t,e,"utf-8"),await l(["commit","-F",t],o)}finally{try{await N.unlink(t)}catch{}}}import W from"fs/promises";import z from"path";var J={"Node.js":["package.json","yarn.lock","package-lock.json","npm-shrinkwrap.json"],Python:["requirements.txt","Pipfile","pyproject.toml","setup.py","setup.cfg","manage.py"],Java:["pom.xml","build.gradle","build.gradle.kts","build.xml",".java-version"],Go:["go.mod","Gopkg.lock"],PHP:["composer.json","composer.lock","index.php"],Ruby:["Gemfile","Gemfile.lock","Rakefile","config.ru",".ruby-version"],Rust:["Cargo.toml","Cargo.lock"],Haskell:["stack.yaml","cabal.project"],Swift:["Package.swift"],Elixir:["mix.exs"],Dart:["pubspec.yaml"],Scala:["build.sbt"],Perl:["Makefile.PL","Build.PL"],R:[".Rproj"]},V={"C#":[".csproj",".sln"],Haskell:[".cabal"],Swift:[".xcodeproj",".xcworkspace"],Kotlin:[".kt",".kts"],"C/C++":[".c",".cpp",".h",".hpp"],JavaScript:[".js",".jsx"],TypeScript:[".ts",".tsx"],Python:[".py"],Java:[".java"]},H={"Node.js":"\u{1F7E2}",Python:"\u{1F40D}",Java:"\u2615",Go:"\u{1F439}",PHP:"\u{1F418}",Ruby:"\u{1F48E}",Rust:"\u{1F980}",Haskell:"\u{1F3A9}",Swift:"\u{1F34E}",Elixir:"\u{1F4A7}",Dart:"\u{1F3AF}",Scala:"\u2696\uFE0F",Perl:"\u{1F42A}",R:"\u{1F4CA}","C#":"\u{1F537}","C/C++":"\u2699\uFE0F",JavaScript:"\u{1F7E8}",TypeScript:"\u{1F537}",Unknown:"\u2753"};function X(e){return H[e]||"\u2753"}function k(e){let o=X(e);s.info(`${o} Linguagem detectada: ${e}
|
|
119
119
|
`)}async function I(e){try{let o=await W.readdir(e);for(let[i,t]of Object.entries(J))for(let n of t)if(!n.includes(z.sep)){if(o.includes(n))return i}for(let[i,t]of Object.entries(V))for(let n of o)if(t.some(r=>n.endsWith(r)))return i;return"Unknown"}catch{return"Unknown"}}import m from"chalk";import{execa as Q}from"execa";import Z from"inquirer";async function M(){console.clear(),console.log(m.bold.blue(`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/services/ai.ts","../src/utils/logger.ts","../src/utils/config.ts","../src/version.ts","../src/utils/git.ts","../src/utils/language.ts","../src/utils/setup.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport path from 'path';\n\nimport { AIService } from './services/ai.js';\nimport { checkConfigExists, loadConfig, validateNodeVersion } from './utils/config.js';\nimport { commitChanges, hasUncommittedChanges, isBranchAhead, performGitPull, runGitCommand } from './utils/git.js';\nimport { detectProjectLanguage, printDetectedLanguage } from './utils/language.js';\nimport { logger } from './utils/logger.js';\nimport { runSetup } from './utils/setup.js';\n\nimport { engines, name, version } from './version.js';\n\n// 0. Validate Node Version\nif (!validateNodeVersion()) {\n console.error(chalk.red(`\\n❌ GitAI requires Node.js ${engines.node} or higher.`));\n console.error(chalk.yellow(` Current version: ${process.version}\\n`));\n process.exit(1);\n}\n\nconst program = new Command();\n\nprogram\n .name(name)\n .description('AI-powered git commit assistant')\n .version(version);\n\n// Custom help handler to show version\nprogram.on('--help', () => {\n console.log('');\n console.log(chalk.cyan('━'.repeat(50)));\n console.log(chalk.bold.blue(` GitAI v${version}`));\n console.log(chalk.dim(' AI-powered git commit assistant'));\n console.log(chalk.cyan('━'.repeat(50)));\n console.log('');\n});\n\nprogram\n .argument('[projectPath]', 'The path to the project', '.')\n .argument('[baseMessage]', 'The base commit message')\n .option('-p, --push', 'Whether to push after committing', false)\n .action(async (projectPathArg, baseMessageArg, options) => {\n \n // 1. Configuration Check (Global Only)\n let config;\n try {\n if (!checkConfigExists()) {\n config = await runSetup();\n } else {\n config = loadConfig();\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to load configuration: ${errorMessage}`);\n process.exit(1);\n }\n\n logger.header(`Gitai v${version}`);\n \n const projectPath = path.resolve(projectPathArg);\n logger.info(`📁 project_path: ${projectPath}\\n`);\n\n const aiService = new AIService({\n provider: config.PROVIDER,\n model: config.MODEL,\n apiKey: config.API_KEY,\n language: config.LANGUAGE\n });\n\n // Change process CWD to project path to ensure git commands run there\n try {\n process.chdir(projectPath);\n } catch {\n logger.error(`Failed to change directory to ${projectPath}`);\n process.exit(1);\n }\n\n // 2. Check for uncommitted changes\n if (await hasUncommittedChanges(projectPath)) {\n logger.warning('Uncommitted local changes detected.');\n \n const projectLanguage = await detectProjectLanguage(projectPath);\n printDetectedLanguage(projectLanguage);\n \n const { stdout: diffOutput } = await runGitCommand(['diff'], projectPath);\n \n // Generate commit message\n // Allow empty base message (will rely on git diffs)\n const baseMessage = baseMessageArg || '';\n\n const commitMessage = await aiService.generateCommitMessage(diffOutput, projectLanguage, baseMessage);\n \n logger.commit(commitMessage);\n \n await commitChanges(commitMessage, projectPath);\n logger.success('Gitai successfully committed local changes.');\n \n } else {\n logger.info('No local changes to commit before git pull.');\n }\n\n // 3. Perform Git Pull\n const pullSuccessful = await performGitPull(projectPath);\n \n if (!pullSuccessful) {\n logger.error('Git pull failed due to conflicts. Please resolve the conflicts manually.');\n process.exit(1);\n }\n\n // 4. Check for conflicts/changes after pull\n if (await hasUncommittedChanges(projectPath)) {\n logger.warning('Conflicts or uncommitted changes detected after pull.');\n \n const projectLanguage = await detectProjectLanguage(projectPath);\n printDetectedLanguage(projectLanguage);\n \n const { stdout: diffOutput } = await runGitCommand(['diff'], projectPath);\n \n const commitMessage = await aiService.generateCommitMessage(diffOutput, projectLanguage, \"Resolving conflicts after git pull\");\n logger.commit(commitMessage);\n \n await commitChanges(commitMessage, projectPath);\n logger.success('Gitai successfully committed changes after pull.');\n\n } else {\n logger.info('No changes to commit after git pull.');\n }\n\n // 5. Push if requested\n if (options.push) {\n if (await isBranchAhead(projectPath)) {\n await runGitCommand(['push'], projectPath);\n logger.success('Gitai successfully pushed changes.');\n } else {\n logger.info('No changes to push. The local branch is synchronized with the remote.');\n }\n }\n\n });\n\nprogram.parse();\n","import Anthropic from '@anthropic-ai/sdk';\nimport Groq from 'groq-sdk';\nimport OpenAI from 'openai';\nimport { logger } from '../utils/logger.js';\n\ninterface AIConfig {\n provider: string;\n model: string;\n apiKey: string;\n language: string;\n}\n\nexport class AIService {\n private config: AIConfig;\n private openai?: OpenAI;\n private groq?: Groq;\n private anthropic?: Anthropic;\n\n constructor(config: AIConfig) {\n this.config = config;\n this.initializeClient();\n }\n\n private initializeClient() {\n switch (this.config.provider) {\n case 'openai':\n this.openai = new OpenAI({ apiKey: this.config.apiKey });\n break;\n case 'groq':\n this.groq = new Groq({ apiKey: this.config.apiKey });\n break;\n case 'anthropic':\n this.anthropic = new Anthropic({ apiKey: this.config.apiKey });\n break;\n default:\n logger.error(`Provider ${this.config.provider} is not supported.`);\n process.exit(1);\n }\n }\n\n private getCommitSystemPrompt(): string {\n return `\nYou are an assistant that helps generate commit messages for a Git repository.\nCommit messages must follow the Conventional Commits standard, which uses ONLY these specific prefixes to categorize the type of change made: feat, fix, docs, chore.\nThe description must be concise and clear, explaining what was done, the reason for the change, and, if applicable, the impact of the change.\nThe messages must be generated based on the changes provided by the 'git diff' command and an optional basic description provided by the user.\n\nMandatory rules:\n- DO NOT add any comments or additional explanations beyond the generated commit message.\n- DO NOT use symbols such as \\`\\`\\` or any other formatting to denote the commit message.\n- DO NOT add line breaks or whitespace before the commit message.\n- The output must be ONLY the final commit message as per the instructions.\n- The first line of the message must start with one of these EXACT prefixes: feat, fix, docs, chore.\n- After the first line, always add an objective explanation of the changes made, the reason for the change, and, if applicable, the impact of the change.\n\n<output_format>\nCRITICAL: Your response must follow this exact structure:\n\nLine 1: [prefix]: [concise description]\n(where prefix must be exactly one of: feat, fix, docs, chore)\nLine 2: [EMPTY LINE - mandatory line break]\nLine 3+: [detailed explanation]\n\nCORRECT format example:\nfeat: add user authentication system\n\nImplement JWT-based authentication with login and registration endpoints. Add middleware for route protection and user session management. This enhancement improves application security and enables personalized user experiences.\n\nINCORRECT format (everything in one line):\nfeat: add user authentication system - Implement JWT-based authentication with login and registration endpoints...\n</output_format>\n\nIf the instructions are not followed correctly, the result will not be accepted.\n`.trim();\n }\n\n private getCommitUserPrompt(diffOutput: string, projectLanguage: string, baseMessage: string): string {\n return `\nBased on the information provided below, create a commit message following the Conventional Commits standard.\n\nThe ONLY accepted prefixes for this project are:\n - feat: A new feature\n - fix: A bug fix\n - docs: Documentation changes\n - chore: Maintenance changes or minor fixes that do not alter functionality\n\nFor your information and better understanding, the project in question uses the programming language ${projectLanguage}.\n\nBasic change description provided by the developer, which you should use as the basis for your message: '${baseMessage}'\n\nBelow are the detailed changes (including modified files and what was added, changed, or removed) generated by the 'git diff' command:\n\n\\`\\`\\`\n${diffOutput}\n\\`\\`\\`\n\nBased on the above information, improve the basic description to create an objective commit message.\nMandatory rules:\n- You must follow the Conventional Commits standard.\n- The first line of the message must start with one of these EXACT prefixes (feat, fix, docs, chore) followed by a concise description explaining what was done.\n- After the first line, always add an objective explanation of the changes made, the reason for the change, and, if applicable, the impact of the change.\n- Whenever possible, mention only the main modified files in the commit message without including the path.\n- DO NOT add any comments or additional explanations beyond the generated commit message.\n- DO NOT use symbols such as \\`\\`\\` or any other formatting to denote the commit message.\n- DO NOT add line breaks or whitespace before the commit message.\n- The output must be ONLY the final commit message as per the instructions.\n- You must use the language '${this.config.language}' in your response generation.\n\n<output_format>\nYour response must follow this exact format:\n\nLine 1: [prefix]: [concise description]\nLine 2: [empty line]\nLine 3+: [detailed explanation of changes, reasons, and impact]\n</output_format>\n`.trim();\n }\n\n async generateCommitMessage(diffOutput: string, projectLanguage: string, baseMessage: string): Promise<string> {\n const systemPrompt = this.getCommitSystemPrompt();\n const userPrompt = this.getCommitUserPrompt(diffOutput, projectLanguage, baseMessage);\n \n const commitMessage = await this.callApi(systemPrompt, userPrompt);\n const signature = \"\\n\\n🤖 Commit generated with [GitaiJS](https://github.com/leandrosilvaferreira/gitai-js)\";\n return commitMessage + signature;\n }\n \n // Logic for release notes (used by releaser.ts)\n async generateReleaseNotes(commits: string, newVersion: string, tag: string): Promise<string> {\n const systemPrompt = `\nYou are an assistant that helps generate release notes for a Git repository.\nCommit messages should be organized into categories such as New Features, Bug Fixes, and Other Changes.\nThe output must be a markdown-formatted text according to the provided template, with no additional comments or formatting.\n`.trim();\n \n const userPrompt = `\nYou are an assistant that helps generate release notes for a Git repository.\nBelow are the commits since the last tag ${tag}.\nPlease organize the commits into the following categories: New Features, Bug Fixes, and Other Changes.\nGenerate a release message in markdown format in the language '${this.config.language}' using the following template:\n\n\\`\\`\\`\n# Release ${newVersion}\n<SUMMARY/>\n\n### New Features\n- Description of new features (commits).\n\n### Bug Fixes\n- Description of bug fixes (commits).\n\n### Other Changes\n- Description of other changes (commits).\n\nWe thank all the contributors who made this release possible! For more details, please refer to the complete version notes.\n\n**Full Changelog:** [See commits for v${newVersion}](https://github.com/leandrosilvaferreira/gitai-js/compare/${tag}...v${newVersion})\n\\`\\`\\`\n\nCommits:\n${commits}\n\nImportant rules:\n - The generated content must be in the language '${this.config.language}'.\n - Replace <SUMMARY/> in the template with a brief and enthusiastic summary of the changes made since the last tag ${tag}.\n - DO NOT add any additional comments or explanations.\n - DO NOT use symbols like \\`\\`\\` to denote commit messages.\n - The message must be clear, concise, and well-organized.\n - Remember to follow the provided template.\n\nIf the instructions are not followed correctly, the result will not be accepted.\n`.trim();\n\n return this.callApi(systemPrompt, userPrompt);\n\n }\n\n\n private async callApi(systemPrompt: string, userPrompt: string): Promise<string> {\n if (this.config.provider === 'openai' && this.openai) {\n logger.ai(`Provider: openai - Model: ${this.config.model}`);\n \n const isNewModel = ['o1', 'o3', 'gpt-5'].some(prefix => this.config.model.startsWith(prefix));\n const tokenParam = isNewModel ? 'max_completion_tokens' : 'max_tokens';\n \n const completion = await this.openai.chat.completions.create({\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n model: this.config.model,\n temperature: 0.5,\n top_p: 1.0,\n frequency_penalty: 0.0,\n presence_penalty: 0.0,\n [tokenParam]: 500,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n\n return completion.choices[0].message.content?.trim() || '';\n\n } else if (this.config.provider === 'groq' && this.groq) {\n logger.ai(`Provider: groq - Model: ${this.config.model}`);\n const completion = await this.groq.chat.completions.create({\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n model: this.config.model,\n temperature: 0.5,\n max_tokens: 500,\n top_p: 1.0,\n frequency_penalty: 0.0,\n presence_penalty: 0.0\n });\n return completion.choices[0].message.content?.trim() || '';\n\n } else if (this.config.provider === 'anthropic' && this.anthropic) {\n logger.ai(`Provider: anthropic - Model: ${this.config.model}`);\n const message = await this.anthropic.messages.create({\n model: this.config.model,\n max_tokens: 500,\n temperature: 0.5,\n system: systemPrompt,\n messages: [\n { role: 'user', content: userPrompt }\n ]\n });\n const contentBlock = message.content[0];\n if (contentBlock.type === 'text') {\n return contentBlock.text.trim();\n }\n return '';\n }\n\n return '';\n }\n}\n","import chalk from 'chalk';\n\nexport const logger = {\n header: (message: string) => {\n console.log(chalk.cyan.bold(`🚀 ${message}`));\n },\n success: (message: string) => {\n console.log(chalk.green.bold(`✅ ${message}`));\n },\n info: (message: string) => {\n console.log(chalk.blue.bold(`ℹ️ ${message}`));\n },\n warning: (message: string) => {\n console.log(chalk.yellow.bold(`⚠️ ${message}`));\n },\n error: (message: string) => {\n console.log(chalk.red.bold(`❌ ${message}`));\n },\n git: (message: string) => {\n console.log(chalk.magenta.bold(`🔄 ${message}`));\n },\n ai: (message: string) => {\n console.log(chalk.cyan.bold(`🤖 ${message}`));\n },\n commit: (message: string) => {\n console.log('\\n' + chalk.bgBlue.white.bold(' Generated commit message: ') + '\\n');\n console.log(chalk.white.bold(message));\n console.log();\n }\n};\n","import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport semver from 'semver';\n\nimport { engines } from '../version.js';\n\nexport interface AppConfig {\n LANGUAGE: string;\n PROVIDER: string;\n API_KEY: string;\n MODEL: string;\n}\n\nexport const CONFIG_PATH = path.join(os.homedir(), '.gitai');\n\nexport const checkConfigExists = (): boolean => {\n try {\n return fs.existsSync(CONFIG_PATH);\n } catch {\n return false;\n }\n};\n\nexport const loadConfig = (): AppConfig => {\n if (!checkConfigExists()) {\n throw new Error(`Configuration file not found at ${CONFIG_PATH}`);\n }\n const content = fs.readFileSync(CONFIG_PATH, 'utf-8');\n const config: Record<string, string> = {};\n content.split('\\n').forEach(line => {\n // Simple env parsing\n const [key, ...value] = line.split('=');\n if (key && value && key.trim()) {\n // Rejoin value in case it contained =\n let val = value.join('=').trim();\n \n // Remove quotes if present\n if (val.startsWith('\"') && val.endsWith('\"')) {\n val = val.slice(1, -1);\n }\n if (val.startsWith(\"'\") && val.endsWith(\"'\")) {\n val = val.slice(1, -1);\n }\n\n config[key.trim()] = val;\n }\n });\n return config as unknown as AppConfig;\n};\n\nexport const saveConfig = (config: AppConfig): void => {\n const content = Object.entries(config)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n \n // Write with secure permissions (600 - read/write only by owner) since it contains API keys\n fs.writeFileSync(CONFIG_PATH, content, { mode: 0o600 });\n};\n\nexport const validateNodeVersion = (): boolean => {\n const requiredVersion = engines.node;\n return semver.satisfies(process.version, requiredVersion);\n};\n","export const version = '0.0.12';\nexport const name = 'gitai';\nexport const engines = {\n node: '>=18'\n};\n","import { execa } from 'execa';\nimport fs from 'fs/promises';\nimport os from 'os';\nimport path from 'path';\nimport { logger } from './logger.js';\n\nexport async function runGitCommand(args: string[], cwd: string = process.cwd(), exitOnError: boolean = true): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n try {\n const result = await execa('git', args, { cwd, reject: false });\n \n if (result.exitCode !== 0) {\n if (exitOnError) {\n logger.error(`Error executing command: git ${args.join(' ')}`);\n logger.error(`Standard output: ${result.stdout}`);\n logger.error(`Error output: ${result.stderr}`);\n process.exit(1);\n }\n }\n return {\n stdout: result.stdout.trim(),\n stderr: result.stderr.trim(),\n exitCode: result.exitCode ?? 1\n };\n } catch (error: unknown) {\n if (exitOnError) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n logger.error(`Unexpected error executing git command: ${errorMessage}`);\n process.exit(1);\n }\n const errorMessage = error instanceof Error ? error.message : String(error);\n return { stdout: '', stderr: errorMessage, exitCode: 1 };\n }\n}\n\nexport async function hasUncommittedChanges(cwd: string): Promise<boolean> {\n const { stdout } = await runGitCommand(['status', '--porcelain'], cwd);\n return stdout.length > 0;\n}\n\nexport async function isBranchAhead(cwd: string): Promise<boolean> {\n const { stdout } = await runGitCommand(['status', '-uno'], cwd);\n return stdout.includes('Your branch is ahead') || stdout.includes('Seu branch está à frente');\n}\n\nexport async function performGitPull(cwd: string): Promise<boolean> {\n const { stdout, stderr, exitCode } = await runGitCommand(['pull'], cwd, false);\n\n if (exitCode !== 0) {\n if (stdout.includes('CONFLICT') || stdout.includes('CONFLITO') || stderr.includes('CONFLICT') || stderr.includes('CONFLITO')) {\n logger.warning(\"Conflitos detectados durante git pull:\");\n logger.error(stdout || stderr);\n return false;\n } else {\n logger.error(`Error executing git pull: ${stdout || stderr}`);\n process.exit(1);\n }\n }\n logger.success(\"Git pull executed successfully.\");\n return true;\n}\n\nexport async function commitChanges(commitMessage: string, cwd: string): Promise<void> {\n await runGitCommand(['add', '.'], cwd);\n \n // Write commit message to temp file to handle special characters correctly\n const tempDir = os.tmpdir();\n const tempFilePath = path.join(tempDir, `gitai_commit_${Date.now()}.txt`);\n \n try {\n await fs.writeFile(tempFilePath, commitMessage, 'utf-8');\n await runGitCommand(['commit', '-F', tempFilePath], cwd);\n } finally {\n try {\n await fs.unlink(tempFilePath);\n } catch {\n // Ignore error if cleanup fails\n }\n }\n}\n","import fs from 'fs/promises';\nimport path from 'path';\nimport { logger } from './logger.js';\n\nconst indicatorFiles: Record<string, string[]> = {\n 'Node.js': ['package.json', 'yarn.lock', 'package-lock.json', 'npm-shrinkwrap.json'],\n 'Python': ['requirements.txt', 'Pipfile', 'pyproject.toml', 'setup.py', 'setup.cfg', 'manage.py'],\n 'Java': ['pom.xml', 'build.gradle', 'build.gradle.kts', 'build.xml', '.java-version'],\n 'Go': ['go.mod', 'Gopkg.lock'],\n 'PHP': ['composer.json', 'composer.lock', 'index.php'],\n 'Ruby': ['Gemfile', 'Gemfile.lock', 'Rakefile', 'config.ru', '.ruby-version'],\n 'Rust': ['Cargo.toml', 'Cargo.lock'],\n 'Haskell': ['stack.yaml', 'cabal.project'],\n 'Swift': ['Package.swift'],\n 'Elixir': ['mix.exs'],\n 'Dart': ['pubspec.yaml'],\n 'Scala': ['build.sbt'],\n 'Perl': ['Makefile.PL', 'Build.PL'],\n 'R': ['.Rproj']\n};\n\nconst extensionIndicators: Record<string, string[]> = {\n 'C#': ['.csproj', '.sln'],\n 'Haskell': ['.cabal'],\n 'Swift': ['.xcodeproj', '.xcworkspace'],\n 'Kotlin': ['.kt', '.kts'],\n 'C/C++': ['.c', '.cpp', '.h', '.hpp'],\n 'JavaScript': ['.js', '.jsx'],\n 'TypeScript': ['.ts', '.tsx'],\n 'Python': ['.py'],\n 'Java': ['.java']\n};\n\nconst languageEmojis: Record<string, string> = {\n 'Node.js': '🟢',\n 'Python': '🐍',\n 'Java': '☕',\n 'Go': '🐹',\n 'PHP': '🐘',\n 'Ruby': '💎',\n 'Rust': '🦀',\n 'Haskell': '🎩',\n 'Swift': '🍎',\n 'Elixir': '💧',\n 'Dart': '🎯',\n 'Scala': '⚖️',\n 'Perl': '🐪',\n 'R': '📊',\n 'C#': '🔷',\n 'C/C++': '⚙️',\n 'JavaScript': '🟨',\n 'TypeScript': '🔷',\n 'Unknown': '❓'\n};\n\nexport function getLanguageEmoji(language: string): string {\n return languageEmojis[language] || '❓';\n}\n\nexport function printDetectedLanguage(language: string): void {\n const emoji = getLanguageEmoji(language);\n logger.info(`${emoji} Linguagem detectada: ${language}\\n`);\n}\n\nexport async function detectProjectLanguage(projectPath: string): Promise<string> {\n try {\n const rootFiles = await fs.readdir(projectPath);\n\n // Check for indicator files in the project root\n for (const [language, indicators] of Object.entries(indicatorFiles)) {\n for (const indicator of indicators) {\n if (indicator.includes(path.sep)) {\n // This logic handles nested paths in indicators if necessary, \n // though node path module might be different. \n // Keeping it simple as per original python logic which used os.path.sep\n // For now, let's assume flat filenames for simplicity unless we see complex ones\n // The python code did: if os.path.sep in indicator...\n } else {\n if (rootFiles.includes(indicator)) {\n return language;\n }\n }\n }\n }\n\n // Check for file extensions in the project root\n for (const [language, extensions] of Object.entries(extensionIndicators)) {\n for (const file of rootFiles) {\n if (extensions.some(ext => file.endsWith(ext))) {\n return language;\n }\n }\n }\n\n // Recursive check logic from python is a bit heavy (os.walk), \n // let's implement a lighter version or skip if not strictly needed.\n // The original scanned the whole tree which can be slow for node_modules.\n // Let's implement a limited depth scan if root check failed.\n // For efficiency, maybe just skip the deep scan for this first version \n // unless the user specifically wants it.\n // Gitai.py uses os.walk which is recursive. \n // Let's assume Unknown for now if not found in root to avoid performance issues in huge JS projects.\n \n return \"Unknown\";\n\n } catch {\n return \"Unknown\";\n }\n}\n","import chalk from 'chalk';\nimport { execa } from 'execa';\nimport inquirer from 'inquirer';\nimport { AppConfig, CONFIG_PATH, saveConfig } from './config.js';\n\nimport { version } from '../version.js';\n\nexport async function runSetup(): Promise<AppConfig> {\n console.clear();\n console.log(chalk.bold.blue(`\\n🚀 Welcome to GitAI v${version} Setup! 🚀`));\n console.log(chalk.dim('Let\\'s get you ready to code with AI assistance.\\n'));\n\n // 1. Check Prerequisites\n try {\n await execa('git', ['--version']);\n console.log(chalk.green('✅ Git is installed!'));\n } catch {\n console.log(chalk.red('❌ Git is NOT installed or not accessible from PATH.'));\n console.log(chalk.yellow('Please install Git before proceeding.'));\n process.exit(1);\n }\n \n console.log(chalk.cyan('\\n⚙️ Global Configuration (saved to ' + CONFIG_PATH + ')\\n'));\n\n // 2. Prompts\n // Inquirer v12+ types might need check, but standard array syntax usually persists or we use separate imports.\n // Assuming standard prompt syntax works for this version as it is the default export typically.\n \n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'LANGUAGE',\n message: 'What language should the AI use for commit messages?',\n choices: [\n { name: 'English', value: 'en' },\n { name: 'Portuguese (Brasil)', value: 'pt-br' },\n { name: 'Spanish', value: 'es' },\n { name: 'French', value: 'fr' },\n { name: 'German', value: 'de' },\n { name: 'Italian', value: 'it' },\n { name: 'Chinese', value: 'zh' },\n { name: 'Japanese', value: 'ja' },\n { name: 'Korean', value: 'ko' }\n ],\n default: 'en'\n },\n {\n type: 'list',\n name: 'PROVIDER',\n message: 'Which AI Provider do you want to use?',\n choices: [\n { name: 'OpenAI', value: 'openai' },\n { name: 'Anthropic', value: 'anthropic' },\n { name: 'Groq', value: 'groq' }\n ],\n default: 'openai'\n },\n {\n type: 'password',\n name: 'API_KEY',\n message: 'Enter your API Key:',\n mask: '*',\n validate: (input: string) => input.length > 0 ? true : 'API Key is required'\n },\n {\n type: 'input',\n name: 'MODEL',\n message: 'Model ID (e.g., gpt-4o, claude-3-5-sonnet):',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: (answers: any) => {\n if (answers.PROVIDER === 'openai') return 'gpt-4o';\n if (answers.PROVIDER === 'anthropic') return 'claude-3-5-sonnet-20240620';\n if (answers.PROVIDER === 'groq') return 'llama3-70b-8192';\n return 'gpt-4o';\n }\n }\n ]);\n\n const config: AppConfig = {\n LANGUAGE: answers.LANGUAGE,\n PROVIDER: answers.PROVIDER,\n API_KEY: answers.API_KEY,\n MODEL: answers.MODEL\n };\n\n saveConfig(config);\n\n console.log(chalk.green('\\n✨ Configuration saved successfully! ✨'));\n console.log(chalk.dim('You are all set. Running GitAI...\\n'));\n\n return config;\n}\n"],"mappings":";AACA,OAAOA,MAAW,QAClB,OAAS,WAAAC,OAAe,YACxB,OAAOC,OAAU,OCHjB,OAAOC,MAAe,oBACtB,OAAOC,MAAU,WACjB,OAAOC,MAAY,SCFnB,OAAOC,MAAW,QAEX,IAAMC,EAAS,CACpB,OAASC,GAAoB,CAC3B,QAAQ,IAAIF,EAAM,KAAK,KAAK,aAAME,CAAO,EAAE,CAAC,CAC9C,EACA,QAAUA,GAAoB,CAC5B,QAAQ,IAAIF,EAAM,MAAM,KAAK,UAAKE,CAAO,EAAE,CAAC,CAC9C,EACA,KAAOA,GAAoB,CACzB,QAAQ,IAAIF,EAAM,KAAK,KAAK,iB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uB,MAAMc,EAAeb,CAAW,IAGnDD,EAAO,MAAM,0EAA0E,EACvF,QAAQ,KAAK,CAAC,GAId,MAAMK,EAAsBJ,CAAW,EAAG,CACzCD,EAAO,QAAQ,uDAAuD,EAEtE,IAAMM,EAAkB,MAAMC,EAAsBN,CAAW,EAC/DO,EAAsBF,CAAe,EAErC,GAAM,CAAE,OAAQG,CAAW,EAAI,MAAMC,EAAc,CAAC,MAAM,EAAGT,CAAW,EAElEW,EAAgB,MAAMT,EAAU,sBAAsBM,EAAYH,EAAiB,oCAAoC,EAC7HN,EAAO,OAAOY,CAAa,EAE3B,MAAMC,EAAcD,EAAeX,CAAW,EAC9CD,EAAO,QAAQ,kDAAkD,CAEtE,MACKA,EAAO,KAAK,sCAAsC,EAInDP,EAAQ,OACJ,MAAMsB,EAAcd,CAAW,GAC/B,MAAMS,EAAc,CAAC,MAAM,EAAGT,CAAW,EACzCD,EAAO,QAAQ,oCAAoC,GAEnDA,EAAO,KAAK,uEAAuE,EAIjG,CAAC,EAEHb,EAAQ,MAAM","names":["chalk","Command","path","Anthropic","Groq","OpenAI","chalk","logger","message","AIService","config","OpenAI","Groq","Anthropic","logger","diffOutput","projectLanguage","baseMessage","systemPrompt","userPrompt","commits","newVersion","tag","tokenParam","prefix","contentBlock","fs","os","path","semver","version","name","engines","CONFIG_PATH","path","os","checkConfigExists","fs","loadConfig","content","config","line","key","value","val","saveConfig","validateNodeVersion","requiredVersion","engines","semver","execa","fs","os","path","runGitCommand","args","cwd","exitOnError","result","execa","logger","error","errorMessage","hasUncommittedChanges","stdout","isBranchAhead","performGitPull","stderr","exitCode","commitChanges","commitMessage","tempDir","os","tempFilePath","path","fs","fs","path","indicatorFiles","extensionIndicators","languageEmojis","getLanguageEmoji","language","printDetectedLanguage","emoji","logger","detectProjectLanguage","projectPath","rootFiles","fs","indicators","indicator","path","extensions","file","ext","chalk","execa","inquirer","runSetup","chalk","version","execa","CONFIG_PATH","answers","inquirer","input","config","saveConfig","validateNodeVersion","chalk","engines","program","Command","name","version","projectPathArg","baseMessageArg","options","config","checkConfigExists","loadConfig","runSetup","error","errorMessage","logger","projectPath","path","aiService","AIService","hasUncommittedChanges","projectLanguage","detectProjectLanguage","printDetectedLanguage","diffOutput","runGitCommand","baseMessage","commitMessage","commitChanges","performGitPull","isBranchAhead"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/services/ai.ts","../src/utils/logger.ts","../src/utils/config.ts","../src/version.ts","../src/utils/git.ts","../src/utils/language.ts","../src/utils/setup.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport path from 'path';\n\nimport { AIService } from './services/ai.js';\nimport { checkConfigExists, loadConfig, validateNodeVersion } from './utils/config.js';\nimport { commitChanges, hasUncommittedChanges, isBranchAhead, performGitPull, runGitCommand } from './utils/git.js';\nimport { detectProjectLanguage, printDetectedLanguage } from './utils/language.js';\nimport { logger } from './utils/logger.js';\nimport { runSetup } from './utils/setup.js';\n\nimport { engines, name, version } from './version.js';\n\n// 0. Validate Node Version\nif (!validateNodeVersion()) {\n console.error(chalk.red(`\\n❌ GitAI requires Node.js ${engines.node} or higher.`));\n console.error(chalk.yellow(` Current version: ${process.version}\\n`));\n process.exit(1);\n}\n\nconst program = new Command();\n\nprogram\n .name(name)\n .description('AI-powered git commit assistant')\n .version(version);\n\n// Custom help handler to show version\nprogram.on('--help', () => {\n console.log('');\n console.log(chalk.cyan('━'.repeat(50)));\n console.log(chalk.bold.blue(` GitAI v${version}`));\n console.log(chalk.dim(' AI-powered git commit assistant'));\n console.log(chalk.cyan('━'.repeat(50)));\n console.log('');\n});\n\nprogram\n .argument('[projectPath]', 'The path to the project', '.')\n .argument('[baseMessage]', 'The base commit message')\n .option('-p, --push', 'Whether to push after committing', false)\n .action(async (projectPathArg, baseMessageArg, options) => {\n \n // 1. Configuration Check (Global Only)\n let config;\n try {\n if (!checkConfigExists()) {\n config = await runSetup();\n } else {\n config = loadConfig();\n }\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n logger.error(`Failed to load configuration: ${errorMessage}`);\n process.exit(1);\n }\n\n logger.header(`Gitai v${version}`);\n \n const projectPath = path.resolve(projectPathArg);\n logger.info(`📁 project_path: ${projectPath}\\n`);\n\n const aiService = new AIService({\n provider: config.PROVIDER,\n model: config.MODEL,\n apiKey: config.API_KEY,\n language: config.LANGUAGE\n });\n\n // Change process CWD to project path to ensure git commands run there\n try {\n process.chdir(projectPath);\n } catch {\n logger.error(`Failed to change directory to ${projectPath}`);\n process.exit(1);\n }\n\n // 2. Check for uncommitted changes\n if (await hasUncommittedChanges(projectPath)) {\n logger.warning('Uncommitted local changes detected.');\n \n const projectLanguage = await detectProjectLanguage(projectPath);\n printDetectedLanguage(projectLanguage);\n \n const { stdout: diffOutput } = await runGitCommand(['diff'], projectPath);\n \n // Generate commit message\n // Allow empty base message (will rely on git diffs)\n const baseMessage = baseMessageArg || '';\n\n const commitMessage = await aiService.generateCommitMessage(diffOutput, projectLanguage, baseMessage);\n \n logger.commit(commitMessage);\n \n await commitChanges(commitMessage, projectPath);\n logger.success('Gitai successfully committed local changes.');\n \n } else {\n logger.info('No local changes to commit before git pull.');\n }\n\n // 3. Perform Git Pull\n const pullSuccessful = await performGitPull(projectPath);\n \n if (!pullSuccessful) {\n logger.error('Git pull failed due to conflicts. Please resolve the conflicts manually.');\n process.exit(1);\n }\n\n // 4. Check for conflicts/changes after pull\n if (await hasUncommittedChanges(projectPath)) {\n logger.warning('Conflicts or uncommitted changes detected after pull.');\n \n const projectLanguage = await detectProjectLanguage(projectPath);\n printDetectedLanguage(projectLanguage);\n \n const { stdout: diffOutput } = await runGitCommand(['diff'], projectPath);\n \n const commitMessage = await aiService.generateCommitMessage(diffOutput, projectLanguage, \"Resolving conflicts after git pull\");\n logger.commit(commitMessage);\n \n await commitChanges(commitMessage, projectPath);\n logger.success('Gitai successfully committed changes after pull.');\n\n } else {\n logger.info('No changes to commit after git pull.');\n }\n\n // 5. Push if requested\n if (options.push) {\n if (await isBranchAhead(projectPath)) {\n await runGitCommand(['push'], projectPath);\n logger.success('Gitai successfully pushed changes.');\n } else {\n logger.info('No changes to push. The local branch is synchronized with the remote.');\n }\n }\n\n });\n\nprogram.parse();\n","import Anthropic from '@anthropic-ai/sdk';\nimport Groq from 'groq-sdk';\nimport OpenAI from 'openai';\nimport { logger } from '../utils/logger.js';\n\ninterface AIConfig {\n provider: string;\n model: string;\n apiKey: string;\n language: string;\n}\n\nexport class AIService {\n private config: AIConfig;\n private openai?: OpenAI;\n private groq?: Groq;\n private anthropic?: Anthropic;\n\n constructor(config: AIConfig) {\n this.config = config;\n this.initializeClient();\n }\n\n private initializeClient() {\n switch (this.config.provider) {\n case 'openai':\n this.openai = new OpenAI({ apiKey: this.config.apiKey });\n break;\n case 'groq':\n this.groq = new Groq({ apiKey: this.config.apiKey });\n break;\n case 'anthropic':\n this.anthropic = new Anthropic({ apiKey: this.config.apiKey });\n break;\n default:\n logger.error(`Provider ${this.config.provider} is not supported.`);\n process.exit(1);\n }\n }\n\n private getCommitSystemPrompt(): string {\n return `\nYou are an assistant that helps generate commit messages for a Git repository.\nCommit messages must follow the Conventional Commits standard, which uses ONLY these specific prefixes to categorize the type of change made: feat, fix, docs, chore.\nThe description must be concise and clear, explaining what was done, the reason for the change, and, if applicable, the impact of the change.\nThe messages must be generated based on the changes provided by the 'git diff' command and an optional basic description provided by the user.\n\nMandatory rules:\n- DO NOT add any comments or additional explanations beyond the generated commit message.\n- DO NOT use symbols such as \\`\\`\\` or any other formatting to denote the commit message.\n- DO NOT add line breaks or whitespace before the commit message.\n- The output must be ONLY the final commit message as per the instructions.\n- The first line of the message must start with one of these EXACT prefixes: feat, fix, docs, chore.\n- After the first line, always add an objective explanation of the changes made, the reason for the change, and, if applicable, the impact of the change.\n\n<output_format>\nCRITICAL: Your response must follow this exact structure:\n\nLine 1: [prefix]: [concise description]\n(where prefix must be exactly one of: feat, fix, docs, chore)\nLine 2: [EMPTY LINE - mandatory line break]\nLine 3+: [detailed explanation]\n\nCORRECT format example:\nfeat: add user authentication system\n\nImplement JWT-based authentication with login and registration endpoints. Add middleware for route protection and user session management. This enhancement improves application security and enables personalized user experiences.\n\nINCORRECT format (everything in one line):\nfeat: add user authentication system - Implement JWT-based authentication with login and registration endpoints...\n</output_format>\n\nIf the instructions are not followed correctly, the result will not be accepted.\n`.trim();\n }\n\n private getCommitUserPrompt(diffOutput: string, projectLanguage: string, baseMessage: string): string {\n return `\nBased on the information provided below, create a commit message following the Conventional Commits standard.\n\nThe ONLY accepted prefixes for this project are:\n - feat: A new feature\n - fix: A bug fix\n - docs: Documentation changes\n - chore: Maintenance changes or minor fixes that do not alter functionality\n\nFor your information and better understanding, the project in question uses the programming language ${projectLanguage}.\n\nBasic change description provided by the developer, which you should use as the basis for your message: '${baseMessage}'\n\nBelow are the detailed changes (including modified files and what was added, changed, or removed) generated by the 'git diff' command:\n\n\\`\\`\\`\n${diffOutput}\n\\`\\`\\`\n\nBased on the above information, improve the basic description to create an objective commit message.\nMandatory rules:\n- You must follow the Conventional Commits standard.\n- The first line of the message must start with one of these EXACT prefixes (feat, fix, docs, chore) followed by a concise description explaining what was done.\n- After the first line, always add an objective explanation of the changes made, the reason for the change, and, if applicable, the impact of the change.\n- Whenever possible, mention only the main modified files in the commit message without including the path.\n- DO NOT add any comments or additional explanations beyond the generated commit message.\n- DO NOT use symbols such as \\`\\`\\` or any other formatting to denote the commit message.\n- DO NOT add line breaks or whitespace before the commit message.\n- The output must be ONLY the final commit message as per the instructions.\n- You must use the language '${this.config.language}' in your response generation.\n\n<output_format>\nYour response must follow this exact format:\n\nLine 1: [prefix]: [concise description]\nLine 2: [empty line]\nLine 3+: [detailed explanation of changes, reasons, and impact]\n</output_format>\n`.trim();\n }\n\n async generateCommitMessage(diffOutput: string, projectLanguage: string, baseMessage: string): Promise<string> {\n const systemPrompt = this.getCommitSystemPrompt();\n const userPrompt = this.getCommitUserPrompt(diffOutput, projectLanguage, baseMessage);\n \n const commitMessage = await this.callApi(systemPrompt, userPrompt);\n const signature = \"\\n\\n🤖 Commit generated with [GitaiJS](https://github.com/leandrosilvaferreira/gitai-js)\";\n return commitMessage + signature;\n }\n \n // Logic for release notes (used by releaser.ts)\n async generateReleaseNotes(commits: string, newVersion: string, tag: string): Promise<string> {\n const systemPrompt = `\nYou are an assistant that helps generate release notes for a Git repository.\nCommit messages should be organized into categories such as New Features, Bug Fixes, and Other Changes.\nThe output must be a markdown-formatted text according to the provided template, with no additional comments or formatting.\n`.trim();\n \n const userPrompt = `\nYou are an assistant that helps generate release notes for a Git repository.\nBelow are the commits since the last tag ${tag}.\nPlease organize the commits into the following categories: New Features, Bug Fixes, and Other Changes.\nGenerate a release message in markdown format in the language '${this.config.language}' using the following template:\n\n\\`\\`\\`\n# Release ${newVersion}\n<SUMMARY/>\n\n### New Features\n- Description of new features (commits).\n\n### Bug Fixes\n- Description of bug fixes (commits).\n\n### Other Changes\n- Description of other changes (commits).\n\nWe thank all the contributors who made this release possible! For more details, please refer to the complete version notes.\n\n**Full Changelog:** [See commits for v${newVersion}](https://github.com/leandrosilvaferreira/gitai-js/compare/${tag}...v${newVersion})\n\\`\\`\\`\n\nCommits:\n${commits}\n\nImportant rules:\n - The generated content must be in the language '${this.config.language}'.\n - Replace <SUMMARY/> in the template with a brief and enthusiastic summary of the changes made since the last tag ${tag}.\n - DO NOT add any additional comments or explanations.\n - DO NOT use symbols like \\`\\`\\` to denote commit messages.\n - The message must be clear, concise, and well-organized.\n - Remember to follow the provided template.\n\nIf the instructions are not followed correctly, the result will not be accepted.\n`.trim();\n\n return this.callApi(systemPrompt, userPrompt);\n\n }\n\n\n private async callApi(systemPrompt: string, userPrompt: string): Promise<string> {\n if (this.config.provider === 'openai' && this.openai) {\n logger.ai(`Provider: openai - Model: ${this.config.model}`);\n \n const isNewModel = ['o1', 'o3', 'gpt-5'].some(prefix => this.config.model.startsWith(prefix));\n const tokenParam = isNewModel ? 'max_completion_tokens' : 'max_tokens';\n \n const completion = await this.openai.chat.completions.create({\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n model: this.config.model,\n temperature: 0.5,\n top_p: 1.0,\n frequency_penalty: 0.0,\n presence_penalty: 0.0,\n [tokenParam]: 500,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n\n return completion.choices[0].message.content?.trim() || '';\n\n } else if (this.config.provider === 'groq' && this.groq) {\n logger.ai(`Provider: groq - Model: ${this.config.model}`);\n const completion = await this.groq.chat.completions.create({\n messages: [\n { role: 'system', content: systemPrompt },\n { role: 'user', content: userPrompt }\n ],\n model: this.config.model,\n temperature: 0.5,\n max_tokens: 500,\n top_p: 1.0,\n frequency_penalty: 0.0,\n presence_penalty: 0.0\n });\n return completion.choices[0].message.content?.trim() || '';\n\n } else if (this.config.provider === 'anthropic' && this.anthropic) {\n logger.ai(`Provider: anthropic - Model: ${this.config.model}`);\n const message = await this.anthropic.messages.create({\n model: this.config.model,\n max_tokens: 500,\n temperature: 0.5,\n system: systemPrompt,\n messages: [\n { role: 'user', content: userPrompt }\n ]\n });\n const contentBlock = message.content[0];\n if (contentBlock.type === 'text') {\n return contentBlock.text.trim();\n }\n return '';\n }\n\n return '';\n }\n}\n","import chalk from 'chalk';\n\nexport const logger = {\n header: (message: string) => {\n console.log(chalk.cyan.bold(`🚀 ${message}`));\n },\n success: (message: string) => {\n console.log(chalk.green.bold(`✅ ${message}`));\n },\n info: (message: string) => {\n console.log(chalk.blue.bold(`ℹ️ ${message}`));\n },\n warning: (message: string) => {\n console.log(chalk.yellow.bold(`⚠️ ${message}`));\n },\n error: (message: string) => {\n console.log(chalk.red.bold(`❌ ${message}`));\n },\n git: (message: string) => {\n console.log(chalk.magenta.bold(`🔄 ${message}`));\n },\n ai: (message: string) => {\n console.log(chalk.cyan.bold(`🤖 ${message}`));\n },\n commit: (message: string) => {\n console.log('\\n' + chalk.bgBlue.white.bold(' Generated commit message: ') + '\\n');\n console.log(chalk.white.bold(message));\n console.log();\n }\n};\n","import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport semver from 'semver';\n\nimport { engines } from '../version.js';\n\nexport interface AppConfig {\n LANGUAGE: string;\n PROVIDER: string;\n API_KEY: string;\n MODEL: string;\n}\n\nexport const CONFIG_PATH = path.join(os.homedir(), '.gitai');\n\nexport const checkConfigExists = (): boolean => {\n try {\n return fs.existsSync(CONFIG_PATH);\n } catch {\n return false;\n }\n};\n\nexport const loadConfig = (): AppConfig => {\n if (!checkConfigExists()) {\n throw new Error(`Configuration file not found at ${CONFIG_PATH}`);\n }\n const content = fs.readFileSync(CONFIG_PATH, 'utf-8');\n const config: Record<string, string> = {};\n content.split('\\n').forEach(line => {\n // Simple env parsing\n const [key, ...value] = line.split('=');\n if (key && value && key.trim()) {\n // Rejoin value in case it contained =\n let val = value.join('=').trim();\n \n // Remove quotes if present\n if (val.startsWith('\"') && val.endsWith('\"')) {\n val = val.slice(1, -1);\n }\n if (val.startsWith(\"'\") && val.endsWith(\"'\")) {\n val = val.slice(1, -1);\n }\n\n config[key.trim()] = val;\n }\n });\n return config as unknown as AppConfig;\n};\n\nexport const saveConfig = (config: AppConfig): void => {\n const content = Object.entries(config)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n \n // Write with secure permissions (600 - read/write only by owner) since it contains API keys\n fs.writeFileSync(CONFIG_PATH, content, { mode: 0o600 });\n};\n\nexport const validateNodeVersion = (): boolean => {\n const requiredVersion = engines.node;\n return semver.satisfies(process.version, requiredVersion);\n};\n","export const version = '1.0.0';\nexport const name = 'gitai';\nexport const engines = {\n node: '>=18'\n};\n","import { execa } from 'execa';\nimport fs from 'fs/promises';\nimport os from 'os';\nimport path from 'path';\nimport { logger } from './logger.js';\n\nexport async function runGitCommand(args: string[], cwd: string = process.cwd(), exitOnError: boolean = true): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n try {\n const result = await execa('git', args, { cwd, reject: false });\n \n if (result.exitCode !== 0) {\n if (exitOnError) {\n logger.error(`Error executing command: git ${args.join(' ')}`);\n logger.error(`Standard output: ${result.stdout}`);\n logger.error(`Error output: ${result.stderr}`);\n process.exit(1);\n }\n }\n return {\n stdout: result.stdout.trim(),\n stderr: result.stderr.trim(),\n exitCode: result.exitCode ?? 1\n };\n } catch (error: unknown) {\n if (exitOnError) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n logger.error(`Unexpected error executing git command: ${errorMessage}`);\n process.exit(1);\n }\n const errorMessage = error instanceof Error ? error.message : String(error);\n return { stdout: '', stderr: errorMessage, exitCode: 1 };\n }\n}\n\nexport async function hasUncommittedChanges(cwd: string): Promise<boolean> {\n const { stdout } = await runGitCommand(['status', '--porcelain'], cwd);\n return stdout.length > 0;\n}\n\nexport async function isBranchAhead(cwd: string): Promise<boolean> {\n const { stdout } = await runGitCommand(['status', '-uno'], cwd);\n return stdout.includes('Your branch is ahead') || stdout.includes('Seu branch está à frente');\n}\n\nexport async function performGitPull(cwd: string): Promise<boolean> {\n const { stdout, stderr, exitCode } = await runGitCommand(['pull'], cwd, false);\n\n if (exitCode !== 0) {\n if (stdout.includes('CONFLICT') || stdout.includes('CONFLITO') || stderr.includes('CONFLICT') || stderr.includes('CONFLITO')) {\n logger.warning(\"Conflitos detectados durante git pull:\");\n logger.error(stdout || stderr);\n return false;\n } else {\n logger.error(`Error executing git pull: ${stdout || stderr}`);\n process.exit(1);\n }\n }\n logger.success(\"Git pull executed successfully.\");\n return true;\n}\n\nexport async function commitChanges(commitMessage: string, cwd: string): Promise<void> {\n await runGitCommand(['add', '.'], cwd);\n \n // Write commit message to temp file to handle special characters correctly\n const tempDir = os.tmpdir();\n const tempFilePath = path.join(tempDir, `gitai_commit_${Date.now()}.txt`);\n \n try {\n await fs.writeFile(tempFilePath, commitMessage, 'utf-8');\n await runGitCommand(['commit', '-F', tempFilePath], cwd);\n } finally {\n try {\n await fs.unlink(tempFilePath);\n } catch {\n // Ignore error if cleanup fails\n }\n }\n}\n","import fs from 'fs/promises';\nimport path from 'path';\nimport { logger } from './logger.js';\n\nconst indicatorFiles: Record<string, string[]> = {\n 'Node.js': ['package.json', 'yarn.lock', 'package-lock.json', 'npm-shrinkwrap.json'],\n 'Python': ['requirements.txt', 'Pipfile', 'pyproject.toml', 'setup.py', 'setup.cfg', 'manage.py'],\n 'Java': ['pom.xml', 'build.gradle', 'build.gradle.kts', 'build.xml', '.java-version'],\n 'Go': ['go.mod', 'Gopkg.lock'],\n 'PHP': ['composer.json', 'composer.lock', 'index.php'],\n 'Ruby': ['Gemfile', 'Gemfile.lock', 'Rakefile', 'config.ru', '.ruby-version'],\n 'Rust': ['Cargo.toml', 'Cargo.lock'],\n 'Haskell': ['stack.yaml', 'cabal.project'],\n 'Swift': ['Package.swift'],\n 'Elixir': ['mix.exs'],\n 'Dart': ['pubspec.yaml'],\n 'Scala': ['build.sbt'],\n 'Perl': ['Makefile.PL', 'Build.PL'],\n 'R': ['.Rproj']\n};\n\nconst extensionIndicators: Record<string, string[]> = {\n 'C#': ['.csproj', '.sln'],\n 'Haskell': ['.cabal'],\n 'Swift': ['.xcodeproj', '.xcworkspace'],\n 'Kotlin': ['.kt', '.kts'],\n 'C/C++': ['.c', '.cpp', '.h', '.hpp'],\n 'JavaScript': ['.js', '.jsx'],\n 'TypeScript': ['.ts', '.tsx'],\n 'Python': ['.py'],\n 'Java': ['.java']\n};\n\nconst languageEmojis: Record<string, string> = {\n 'Node.js': '🟢',\n 'Python': '🐍',\n 'Java': '☕',\n 'Go': '🐹',\n 'PHP': '🐘',\n 'Ruby': '💎',\n 'Rust': '🦀',\n 'Haskell': '🎩',\n 'Swift': '🍎',\n 'Elixir': '💧',\n 'Dart': '🎯',\n 'Scala': '⚖️',\n 'Perl': '🐪',\n 'R': '📊',\n 'C#': '🔷',\n 'C/C++': '⚙️',\n 'JavaScript': '🟨',\n 'TypeScript': '🔷',\n 'Unknown': '❓'\n};\n\nexport function getLanguageEmoji(language: string): string {\n return languageEmojis[language] || '❓';\n}\n\nexport function printDetectedLanguage(language: string): void {\n const emoji = getLanguageEmoji(language);\n logger.info(`${emoji} Linguagem detectada: ${language}\\n`);\n}\n\nexport async function detectProjectLanguage(projectPath: string): Promise<string> {\n try {\n const rootFiles = await fs.readdir(projectPath);\n\n // Check for indicator files in the project root\n for (const [language, indicators] of Object.entries(indicatorFiles)) {\n for (const indicator of indicators) {\n if (indicator.includes(path.sep)) {\n // This logic handles nested paths in indicators if necessary, \n // though node path module might be different. \n // Keeping it simple as per original python logic which used os.path.sep\n // For now, let's assume flat filenames for simplicity unless we see complex ones\n // The python code did: if os.path.sep in indicator...\n } else {\n if (rootFiles.includes(indicator)) {\n return language;\n }\n }\n }\n }\n\n // Check for file extensions in the project root\n for (const [language, extensions] of Object.entries(extensionIndicators)) {\n for (const file of rootFiles) {\n if (extensions.some(ext => file.endsWith(ext))) {\n return language;\n }\n }\n }\n\n // Recursive check logic from python is a bit heavy (os.walk), \n // let's implement a lighter version or skip if not strictly needed.\n // The original scanned the whole tree which can be slow for node_modules.\n // Let's implement a limited depth scan if root check failed.\n // For efficiency, maybe just skip the deep scan for this first version \n // unless the user specifically wants it.\n // Gitai.py uses os.walk which is recursive. \n // Let's assume Unknown for now if not found in root to avoid performance issues in huge JS projects.\n \n return \"Unknown\";\n\n } catch {\n return \"Unknown\";\n }\n}\n","import chalk from 'chalk';\nimport { execa } from 'execa';\nimport inquirer from 'inquirer';\nimport { AppConfig, CONFIG_PATH, saveConfig } from './config.js';\n\nimport { version } from '../version.js';\n\nexport async function runSetup(): Promise<AppConfig> {\n console.clear();\n console.log(chalk.bold.blue(`\\n🚀 Welcome to GitAI v${version} Setup! 🚀`));\n console.log(chalk.dim('Let\\'s get you ready to code with AI assistance.\\n'));\n\n // 1. Check Prerequisites\n try {\n await execa('git', ['--version']);\n console.log(chalk.green('✅ Git is installed!'));\n } catch {\n console.log(chalk.red('❌ Git is NOT installed or not accessible from PATH.'));\n console.log(chalk.yellow('Please install Git before proceeding.'));\n process.exit(1);\n }\n \n console.log(chalk.cyan('\\n⚙️ Global Configuration (saved to ' + CONFIG_PATH + ')\\n'));\n\n // 2. Prompts\n // Inquirer v12+ types might need check, but standard array syntax usually persists or we use separate imports.\n // Assuming standard prompt syntax works for this version as it is the default export typically.\n \n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'LANGUAGE',\n message: 'What language should the AI use for commit messages?',\n choices: [\n { name: 'English', value: 'en' },\n { name: 'Portuguese (Brasil)', value: 'pt-br' },\n { name: 'Spanish', value: 'es' },\n { name: 'French', value: 'fr' },\n { name: 'German', value: 'de' },\n { name: 'Italian', value: 'it' },\n { name: 'Chinese', value: 'zh' },\n { name: 'Japanese', value: 'ja' },\n { name: 'Korean', value: 'ko' }\n ],\n default: 'en'\n },\n {\n type: 'list',\n name: 'PROVIDER',\n message: 'Which AI Provider do you want to use?',\n choices: [\n { name: 'OpenAI', value: 'openai' },\n { name: 'Anthropic', value: 'anthropic' },\n { name: 'Groq', value: 'groq' }\n ],\n default: 'openai'\n },\n {\n type: 'password',\n name: 'API_KEY',\n message: 'Enter your API Key:',\n mask: '*',\n validate: (input: string) => input.length > 0 ? true : 'API Key is required'\n },\n {\n type: 'input',\n name: 'MODEL',\n message: 'Model ID (e.g., gpt-4o, claude-3-5-sonnet):',\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: (answers: any) => {\n if (answers.PROVIDER === 'openai') return 'gpt-4o';\n if (answers.PROVIDER === 'anthropic') return 'claude-3-5-sonnet-20240620';\n if (answers.PROVIDER === 'groq') return 'llama3-70b-8192';\n return 'gpt-4o';\n }\n }\n ]);\n\n const config: AppConfig = {\n LANGUAGE: answers.LANGUAGE,\n PROVIDER: answers.PROVIDER,\n API_KEY: answers.API_KEY,\n MODEL: answers.MODEL\n };\n\n saveConfig(config);\n\n console.log(chalk.green('\\n✨ Configuration saved successfully! ✨'));\n console.log(chalk.dim('You are all set. Running GitAI...\\n'));\n\n return config;\n}\n"],"mappings":";AACA,OAAOA,MAAW,QAClB,OAAS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Q,qCAAqC,EAEpD,IAAMM,EAAkB,MAAMC,EAAsBN,CAAW,EAC/DO,EAAsBF,CAAe,EAErC,GAAM,CAAE,OAAQG,CAAW,EAAI,MAAMC,EAAc,CAAC,MAAM,EAAGT,CAAW,EAIlEU,EAAcnB,GAAkB,GAEhCoB,EAAgB,MAAMT,EAAU,sBAAsBM,EAAYH,EAAiBK,CAAW,EAEpGX,EAAO,OAAOY,CAAa,EAE3B,MAAMC,EAAcD,EAAeX,CAAW,EAC9CD,EAAO,QAAQ,6CAA6C,CAEhE,MACIA,EAAO,KAAK,6CAA6C,EAY7D,GARuB,MAAMc,EAAeb,CAAW,IAGnDD,EAAO,MAAM,0EAA0E,EACvF,QAAQ,KAAK,CAAC,GAId,MAAMK,EAAsBJ,CAAW,EAAG,CACzCD,EAAO,QAAQ,uDAAuD,EAEtE,IAAMM,EAAkB,MAAMC,EAAsBN,CAAW,EAC/DO,EAAsBF,CAAe,EAErC,GAAM,CAAE,OAAQG,CAAW,EAAI,MAAMC,EAAc,CAAC,MAAM,EAAGT,CAAW,EAElEW,EAAgB,MAAMT,EAAU,sBAAsBM,EAAYH,EAAiB,oCAAoC,EAC7HN,EAAO,OAAOY,CAAa,EAE3B,MAAMC,EAAcD,EAAeX,CAAW,EAC9CD,EAAO,QAAQ,kDAAkD,CAEtE,MACKA,EAAO,KAAK,sCAAsC,EAInDP,EAAQ,OACJ,MAAMsB,EAAcd,CAAW,GAC/B,MAAMS,EAAc,CAAC,MAAM,EAAGT,CAAW,EACzCD,EAAO,QAAQ,oCAAoC,GAEnDA,EAAO,KAAK,uEAAuE,EAIjG,CAAC,EAEHb,EAAQ,MAAM","names":["chalk","Command","path","Anthropic","Groq","OpenAI","chalk","logger","message","AIService","config","OpenAI","Groq","Anthropic","logger","diffOutput","projectLanguage","baseMessage","systemPrompt","userPrompt","commits","newVersion","tag","tokenParam","prefix","contentBlock","fs","os","path","semver","version","name","engines","CONFIG_PATH","path","os","checkConfigExists","fs","loadConfig","content","config","line","key","value","val","saveConfig","validateNodeVersion","requiredVersion","engines","semver","execa","fs","os","path","runGitCommand","args","cwd","exitOnError","result","execa","logger","error","errorMessage","hasUncommittedChanges","stdout","isBranchAhead","performGitPull","stderr","exitCode","commitChanges","commitMessage","tempDir","os","tempFilePath","path","fs","fs","path","indicatorFiles","extensionIndicators","languageEmojis","getLanguageEmoji","language","printDetectedLanguage","emoji","logger","detectProjectLanguage","projectPath","rootFiles","fs","indicators","indicator","path","extensions","file","ext","chalk","execa","inquirer","runSetup","chalk","version","execa","CONFIG_PATH","answers","inquirer","input","config","saveConfig","validateNodeVersion","chalk","engines","program","Command","name","version","projectPathArg","baseMessageArg","options","config","checkConfigExists","loadConfig","runSetup","error","errorMessage","logger","projectPath","path","aiService","AIService","hasUncommittedChanges","projectLanguage","detectProjectLanguage","printDetectedLanguage","diffOutput","runGitCommand","baseMessage","commitMessage","commitChanges","performGitPull","isBranchAhead"]}
|