@ridiormf/version-control 1.1.1 → 1.1.3

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 CHANGED
@@ -1,131 +1,129 @@
1
1
  # Version Control
2
2
 
3
- > Sistema inteligente de controle de versão que analisa commits do Git e automatiza o versionamento semântico (SemVer).
3
+ [![en](https://img.shields.io/badge/lang-en-blue.svg)](README.md)
4
+ [![pt](https://img.shields.io/badge/lang-pt-green.svg)](README.pt.md)
5
+ [![es](https://img.shields.io/badge/lang-es-yellow.svg)](README.es.md)
6
+ [![fr](https://img.shields.io/badge/lang-fr-purple.svg)](README.fr.md)
7
+
8
+ > Intelligent version control system that analyzes Git commits and automates semantic versioning (SemVer).
4
9
 
5
10
  [![npm version](https://img.shields.io/npm/v/@ridio/version-control.svg)](https://www.npmjs.com/package/@ridio/version-control)
6
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
12
 
8
- ## 📋 Índice
13
+ ## 📋 Table of Contents
9
14
 
10
- - [Sobre](#sobre)
11
- - [Instalação](#instalação)
12
- - [Uso](#uso)
13
- - [Como Funciona](#como-funciona)
14
- - [Exemplos](#exemplos)
15
+ - [About](#about)
16
+ - [Installation](#installation)
17
+ - [Usage](#usage)
18
+ - [How It Works](#how-it-works)
19
+ - [Examples](#examples)
15
20
  - [API](#api)
16
- - [Contribuindo](#contribuindo)
17
- - [Licença](#licença)
21
+ - [Contributing](#contributing)
22
+ - [License](#license)
23
+
24
+ ## 🎯 About
25
+
26
+ **Version Control** automates semantic versioning of your project, eliminating the need to manually decide between MAJOR, MINOR, or PATCH.
27
+
28
+ **Why was it created?**
18
29
 
19
- ## 🎯 Sobre
30
+ Manual versioning is error-prone and inconsistent across teams. This tool solves:
20
31
 
21
- O **Version Control** é uma ferramenta CLI que automatiza o processo de versionamento semântico do seu projeto. Ele analisa as mensagens de commit do Git, identifica os tipos de mudanças (breaking changes, novas funcionalidades, correções de bugs) e sugere automaticamente a versão apropriada segundo as especificações do [Semantic Versioning](https://semver.org/).
32
+ - Forgetting to update \`package.json\`, \`CHANGELOG.md\`, or tags
33
+ - ❌ Confusion about which version to use (MAJOR/MINOR/PATCH)
34
+ - ❌ Incomplete or disorganized CHANGELOGs
35
+ - ❌ Inconsistent commit messages
22
36
 
23
- ### ✨ Funcionalidades
37
+ **Solution:**
24
38
 
25
- - 🔍 **Análise Inteligente de Commits**: Analisa mensagens de commit e arquivos modificados
26
- - 🎯 **Sugestão Automática de Versão**: Sugere MAJOR, MINOR ou PATCH baseado nas mudanças
27
- - 📝 **Atualização Automática**: Atualiza `package.json`, `CHANGELOG.md` e arquivos de código
28
- - 🏷️ **Git Tags**: Cria tags automaticamente e faz push para o repositório
29
- - 🎨 **Interface Colorida**: Output colorido e intuitivo no terminal
30
- - 🔄 **Interativo**: Permite confirmar ou modificar a versão sugerida
31
- - 🤖 **Smart Commit**: Gera mensagens de commit automaticamente em inglês (Conventional Commits)
32
- - 📋 **CHANGELOG Inteligente**: Agrupa commits por tipo e remove duplicatas
33
- - 🧪 **Modo de Teste**: Teste mudanças com rollback automático
34
- - 🌍 **Internacionalização**: Suporte automático para 4 idiomas (EN, PT, ES, FR)
39
+ - Automatically analyzes commits and suggests the correct version
40
+ - Updates all files at once
41
+ - Generates organized and complete CHANGELOGs
42
+ - Creates tags and pushes automatically
35
43
 
36
- ## 📦 Instalação
44
+ ### Features
37
45
 
38
- ### Global (Recomendado)
46
+ - 🔍 **Intelligent Analysis**: Analyzes commit messages and modified files
47
+ - 🎯 **Automatic Suggestion**: Suggests MAJOR, MINOR, or PATCH based on changes
48
+ - 📝 **Automatic Update**: Updates \`package.json\`, \`CHANGELOG.md\`, and code files
49
+ - 🏷️ **Git Tags**: Creates tags automatically and pushes to repository
50
+ - 🤖 **Smart Commit**: Generates commit messages following Conventional Commits
51
+ - 📋 **Intelligent CHANGELOG**: Groups commits by type and removes duplicates
52
+ - 🧪 **Test Mode**: Allows automatic rollback
53
+ - 🌍 **Internationalization**: Support for EN, PT, ES, FR
39
54
 
40
- ```bash
55
+ ## 📦 Installation
56
+
57
+ ### Global (Recommended)
58
+
59
+ \`\`\`bash
41
60
  yarn global add @ridiormf/version-control
42
- # ou
61
+ # or
43
62
  npm install -g @ridiormf/version-control
44
- ```
63
+ \`\`\`
45
64
 
46
- ### Como dependência de desenvolvimento
65
+ ### As a development dependency
47
66
 
48
- ```bash
67
+ \`\`\`bash
49
68
  yarn add -D @ridiormf/version-control
50
- # ou
69
+ # or
51
70
  npm install -D @ridiormf/version-control
52
- ```
71
+ \`\`\`
53
72
 
54
- ### Uso com npx (sem instalação)
73
+ ### Using npx (no installation)
55
74
 
56
- ```bash
75
+ \`\`\`bash
57
76
  npx @ridiormf/version-control
58
- # ou
77
+ # or
59
78
  yarn dlx @ridiormf/version-control
60
- ```
79
+ \`\`\`
61
80
 
62
- ## 🚀 Uso
81
+ ## 🚀 Usage
63
82
 
64
83
  ### CLI - Version Control
65
84
 
66
- Após fazer suas alterações e commitar:
85
+ After making your changes and committing:
67
86
 
68
- ```bash
87
+ \`\`\`bash
69
88
  version-control
70
- ```
89
+ \`\`\`
71
90
 
72
- Ou com npx (sem instalar):
91
+ Or with npx (without installing):
73
92
 
74
- ```bash
93
+ \`\`\`bash
75
94
  npx @ridiormf/version-control
76
- ```
95
+ \`\`\`
77
96
 
78
97
  ### CLI - Smart Commit
79
98
 
80
- Commit inteligente com mensagem automática em inglês:
99
+ Intelligent commit with automatic message:
81
100
 
82
- ```bash
83
- # 1. Faça suas alterações
84
- vim src/index.ts
85
-
86
- # 2. Adicione os arquivos
101
+ \`\`\`bash
87
102
  git add .
88
-
89
- # 3. Execute o smart commit
90
103
  smart-commit
91
- # ou
92
- yarn commit
93
-
94
- # 4. Pressione Enter para aceitar a mensagem gerada
95
- ```
104
+ \`\`\`
96
105
 
97
- **Exemplo de saída:**
98
-
99
- ```bash
100
- ═══════════════════════════════════════════════════════════
101
- Smart Commit - Auto Message
102
- ═══════════════════════════════════════════════════════════
106
+ **Example:**
103
107
 
108
+ \`\`\`bash
104
109
  Staged files: 2
105
110
  ✨ src/newFeature.ts (+45/-0)
106
111
  📝 src/index.ts (+5/-2)
107
112
 
108
- Analyzing changes...
109
-
110
113
  Generated commit message:
111
114
  feat(src): add newFeature
112
115
 
113
- Details:
114
- Type: feat
115
- Scope: src
116
- Description: add newFeature
117
-
118
- Options: [1] Commit [2] Edit [3] Cancel (default: 1)
119
- Choice:
116
+ Options: [1] Commit [2] Edit [3] Cancel
117
+ Choice: 1
120
118
 
121
119
  ✓ Commit created successfully!
122
- ```
120
+ \`\`\`
123
121
 
124
- ### Adicionando ao package.json
122
+ ### Adding to package.json
125
123
 
126
- Adicione um script no seu `package.json`:
124
+ Add a script to your \`package.json\`:
127
125
 
128
- ```json
126
+ \`\`\`json
129
127
  {
130
128
  "scripts": {
131
129
  "version": "version-control",
@@ -133,582 +131,266 @@ Adicione um script no seu `package.json`:
133
131
  "commit": "smart-commit"
134
132
  }
135
133
  }
136
- ```
134
+ \`\`\`
137
135
 
138
- E execute:
136
+ And run:
139
137
 
140
- ```bash
141
- # Commit inteligente
138
+ \`\`\`bash
139
+ # Smart commit
142
140
  yarn commit
143
141
 
144
- # Versionamento normal
142
+ # Normal versioning
145
143
  yarn version
146
144
 
147
- # Versionamento com teste (permite desfazer)
145
+ # Test versioning (allows rollback)
148
146
  yarn version:test
149
- ```
147
+ \`\`\`
150
148
 
151
- ### Uso Programático
149
+ ### Programmatic Usage
152
150
 
153
- Você também pode usar a biblioteca programaticamente:
151
+ Use the library in your custom scripts:
154
152
 
155
- ```typescript
153
+ \`\`\`typescript
156
154
  import {
157
155
  analyzeChanges,
158
156
  bumpVersion,
159
157
  getCurrentVersion,
160
- } from "@ridio/version-control";
158
+ updatePackageJson,
159
+ updateChangelog,
160
+ executeGitCommands,
161
+ } from "@ridiormf/version-control";
161
162
 
162
- // Obter versão atual
163
+ // 1. Get current version
163
164
  const currentVersion = getCurrentVersion();
164
- console.log("Versão atual:", currentVersion);
165
+ // Returns: "1.2.3"
165
166
 
166
- // Analisar mudanças do último commit
167
+ // 2. Analyze changes from last commit
167
168
  const analysis = analyzeChanges();
168
- console.log("Tipo sugerido:", analysis.type);
169
- console.log("Razões:", analysis.reason);
169
+ // Returns: { type: 'minor', reason: ['New feature added'], filesChanged: [...], commitMsg: '...' }
170
170
 
171
- // Calcular nova versão
171
+ // 3. Calculate new version
172
172
  const newVersion = bumpVersion(currentVersion, analysis.type);
173
- console.log("Nova versão:", newVersion);
174
- ```
175
-
176
- ## 🔧 Como Funciona
177
-
178
- O sistema analisa as mudanças do último commit do Git e sugere a versão apropriada baseado em:
179
-
180
- ### � Conventional Commits
181
-
182
- A ferramenta suporta o formato [Conventional Commits](https://www.conventionalcommits.org/), que estrutura as mensagens de commit de forma padronizada:
183
-
184
- ```
185
- <tipo>(<escopo>): <descrição>
186
-
187
- [corpo opcional]
188
-
189
- [rodapé(s) opcional(is)]
190
- ```
191
-
192
- **Exemplos:**
193
-
194
- - `feat(auth): add login functionality`
195
- - `fix: resolve memory leak in cache`
196
- - `feat!: remove support for Node 12` (breaking change)
197
-
198
- ### 📋 CHANGELOG Inteligente
199
-
200
- Todos os commits desde a última versão são **automaticamente incluídos** no CHANGELOG, agrupados por tipo:
201
-
202
- - **✨ Added** - Novas funcionalidades (`feat:`, `add`, `new`)
203
- - **🐛 Fixed** - Correções de bugs (`fix:`, `bug`)
204
- - **🔄 Changed** - Mudanças em funcionalidades (`refactor:`, `perf:`)
205
- - **⚠️ Breaking Changes** - Mudanças incompatíveis (`BREAKING CHANGE`, `!`)
206
- - **🗑️ Removed** - Remoções (`remove`, `delete`)
207
- - **🔒 Security** - Correções de segurança (`security`)
208
- - **⚠️ Deprecated** - Funcionalidades obsoletas (`deprecat`)
209
-
210
- A ferramenta **remove automaticamente** duplicatas e commits similares, mantendo apenas as entradas mais relevantes.
211
-
212
- ### 🤖 Smart Commit - Mensagens Automáticas
213
-
214
- O **Smart Commit** analisa os arquivos staged e gera mensagens de commit automaticamente em inglês, seguindo o padrão Conventional Commits:
215
-
216
- #### Como funciona:
217
-
218
- 1. **Analisa os arquivos**: Detecta arquivos adicionados, modificados ou deletados
219
- 2. **Identifica o tipo**: feat, fix, docs, test, refactor, style, chore
220
- 3. **Detecta o escopo**: Identifica automaticamente (src, api, ui, etc.)
221
- 4. **Gera a descrição**: Baseado nos nomes dos arquivos e padrões de mudança
222
-
223
- #### Tipos detectados automaticamente:
173
+ // Returns: "1.3.0"
224
174
 
225
- - **feat**: Novos arquivos ou funcionalidades
226
- - **fix**: Mais deleções que adições (correções)
227
- - **docs**: Apenas arquivos de documentação (.md, .txt)
228
- - **test**: Apenas arquivos de teste
229
- - **style**: Mudanças pequenas em CSS/SCSS
230
- - **refactor**: Modificações em código existente
231
- - **chore**: Configurações e arquivos auxiliares
175
+ // 4. Update files
176
+ updatePackageJson(newVersion);
177
+ updateChangelog(newVersion, analysis.type, analysis);
232
178
 
233
- #### Exemplo:
179
+ // 5. Commit and create tag
180
+ executeGitCommands(newVersion);
181
+ \`\`\`
234
182
 
235
- ```bash
236
- # Adicionar novo arquivo
237
- git add src/authentication.ts
238
- yarn commit
239
- # Gera: feat(src): add authentication
240
-
241
- # Corrigir bug
242
- git add src/bugFix.ts
243
- yarn commit
244
- # Gera: fix(src): resolve issue in bugFix
245
-
246
- # Atualizar documentação
247
- git add README.md
248
- yarn commit
249
- # Gera: docs: update README
250
- ```
251
-
252
- #### 🎉 Versão Inicial (1.0.0)
253
-
254
- Quando a ferramenta detecta que está gerando a versão **1.0.0** (primeira release), ela adiciona uma mensagem especial no CHANGELOG:
255
-
256
- ```markdown
257
- ## [1.0.0] - 2025-12-24
183
+ ## 🔧 How It Works
258
184
 
259
- ### 🎉 Initial Release
185
+ The system analyzes changes from the last Git commit and suggests the appropriate version based on Conventional Commits format and file changes.
260
186
 
261
- Primeira versão pública do projeto.
262
- ```
187
+ ### 🔴 MAJOR (X.0.0) - Breaking Changes
263
188
 
264
- Esta é uma regra automática aplicada a **qualquer projeto** que usar a ferramenta pela primeira vez.
189
+ Detected when the commit message contains keywords like:
265
190
 
266
- ### �🔴 MAJOR (X.0.0) - Breaking Changes
191
+ - \`breaking\`, \`break\`, \`incompatible\`, \`remove\`, \`delete\`, \`rewrite\`
267
192
 
268
- Detectado quando a mensagem de commit contém palavras-chave como:
193
+ **Example:**
269
194
 
270
- - `breaking`, `break`
271
- - `incompatível`, `incompatible`
272
- - `remove`, `delete`
273
- - `refactor completo`, `rewrite`
274
-
275
- **Exemplo:**
276
-
277
- ```bash
195
+ \`\`\`bash
278
196
  git commit -m "breaking: remove deprecated API methods"
279
- # Sugere: 1.5.3 → 2.0.0
280
- ```
197
+ # Suggests: 1.5.3 → 2.0.0
198
+ \`\`\`
281
199
 
282
- ### 🟡 MINOR (x.Y.0) - Novas Funcionalidades
200
+ ### 🟡 MINOR (x.Y.0) - New Features
283
201
 
284
- Detectado quando:
202
+ Detected when:
285
203
 
286
- - Mensagem contém: `add`, `new`, `feature`, `implement`, `create`
287
- - Novos arquivos são adicionados ao projeto
288
- - Arquivos de configuração são modificados
204
+ - Message contains: \`add\`, \`new\`, \`feature\`, \`implement\`, \`create\`
205
+ - New files are added to the project
206
+ - Configuration files are modified
289
207
 
290
- **Exemplo:**
208
+ **Example:**
291
209
 
292
- ```bash
210
+ \`\`\`bash
293
211
  git commit -m "feat: add user authentication module"
294
- # Sugere: 1.5.3 → 1.6.0
295
- ```
212
+ # Suggests: 1.5.3 → 1.6.0
213
+ \`\`\`
296
214
 
297
- ### 🟢 PATCH (x.y.Z) - Correções
215
+ ### 🟢 PATCH (x.y.Z) - Fixes
298
216
 
299
- Detectado quando a mensagem contém:
217
+ Detected when the message contains:
300
218
 
301
- - `fix`, `bug`, `error`
302
- - `correção`, `ajuste`
303
- - Pequenas mudanças sem novos arquivos
219
+ - \`fix\`, \`bug\`, \`error\`
220
+ - Small changes without new files
304
221
 
305
- **Exemplo:**
222
+ **Example:**
306
223
 
307
- ```bash
224
+ \`\`\`bash
308
225
  git commit -m "fix: resolve memory leak in cache"
309
- # Sugere: 1.5.3 → 1.5.4
310
- ```
311
-
312
- ### 📊 Entendendo o Impacto de Cada Tipo de Versão
313
-
314
- Seguindo o [Semantic Versioning (SemVer)](https://semver.org/), cada tipo de versão tem um significado específico e impacta diferentes aspectos do seu projeto:
315
-
316
- #### 🔴 MAJOR (X.0.0) - Quando usar?
317
-
318
- **Use MAJOR quando você fizer mudanças incompatíveis na API/interface pública.**
319
-
320
- **Impactos:**
321
-
322
- - ⚠️ **Quebra compatibilidade**: Usuários precisarão atualizar o código deles
323
- - 🔧 **Requer migração**: Pode necessitar guia de migração
324
- - 📢 **Comunicação crítica**: Deve ser amplamente comunicado
325
- - 🚨 **Risco alto**: Pode causar falhas em projetos dependentes
326
-
327
- **Exemplos de mudanças MAJOR:**
328
-
329
- ```javascript
330
- // ❌ Remover funções/métodos públicos
331
- - export function oldMethod() { } // Removido
332
-
333
- // ❌ Mudar assinatura de funções
334
- - function process(data: string): void
335
- + function process(data: object, options: Options): Promise<void>
336
-
337
- // ❌ Alterar comportamento esperado
338
- - return { success: true } // Antes retornava objeto
339
- + return true // Agora retorna boolean
340
-
341
- // ❌ Remover ou renomear propriedades públicas
342
- - interface User { username: string }
343
- + interface User { name: string } // Quebra código existente
344
- ```
345
-
346
- **Quando evitar:** Se possível, adicione a nova funcionalidade sem remover a antiga (deprecated) e só remova na próxima MAJOR.
347
-
348
- #### 🟡 MINOR (x.Y.0) - Quando usar?
349
-
350
- **Use MINOR quando você adicionar funcionalidades novas, mantendo compatibilidade com versões anteriores.**
351
-
352
- **Impactos:**
353
-
354
- - ✅ **Mantém compatibilidade**: Código existente continua funcionando
355
- - 🎁 **Adiciona valor**: Novas features disponíveis
356
- - 📈 **Evolução natural**: Crescimento do projeto
357
- - 🔄 **Upgrade seguro**: Usuários podem atualizar sem medo
358
-
359
- **Exemplos de mudanças MINOR:**
360
-
361
- ```javascript
362
- // ✅ Adicionar novas funções/métodos
363
- + export function newFeature() { } // Nova função
364
-
365
- // ✅ Adicionar novos parâmetros opcionais
366
- - function process(data: string): void
367
- + function process(data: string, options?: Options): void
368
-
369
- // ✅ Adicionar novas propriedades opcionais
370
- interface User {
371
- username: string;
372
- + email?: string; // Novo campo opcional
373
- }
226
+ # Suggests: 1.5.3 → 1.5.4
227
+ \`\`\`
374
228
 
375
- // Adicionar novas classes/módulos
376
- + export class NewService { } // Nova funcionalidade
377
- ```
229
+ ### 📊 Semantic Versioning
378
230
 
379
- **Quando usar:** Sempre que adicionar algo novo que não quebra código existente.
231
+ \`\`\`
232
+ Breaks existing code?
233
+ ├─ YES → 🔴 MAJOR (X.0.0)
234
+ └─ NO → Adds functionality?
235
+ ├─ YES → 🟡 MINOR (x.Y.0)
236
+ └─ NO → 🟢 PATCH (x.y.Z)
237
+ \`\`\`
380
238
 
381
- #### 🟢 PATCH (x.y.Z) - Quando usar?
239
+ See more at [semver.org](https://semver.org/)
382
240
 
383
- **Use PATCH quando você corrigir bugs, sem adicionar funcionalidades ou quebrar compatibilidade.**
241
+ ## 📖 Examples
384
242
 
385
- **Impactos:**
243
+ ### Typical Flow
386
244
 
387
- - 🐛 **Corrige problemas**: Bugs são resolvidos
388
- - 🔒 **Totalmente seguro**: Zero risco de quebrar código
389
- - ⚡ **Deve ser automático**: Usuários devem poder atualizar sem pensar
390
- - 🎯 **Foco em estabilidade**: Melhora qualidade sem mudanças
391
-
392
- **Exemplos de mudanças PATCH:**
393
-
394
- ```javascript
395
- // ✅ Corrigir bugs
396
- - if (value > 10) // Bug: deveria ser >=
397
- + if (value >= 10)
398
-
399
- // ✅ Corrigir tipos/documentação
400
- - * @param value - Must be string // Documentação errada
401
- + * @param value - Must be number
402
-
403
- // ✅ Melhorar performance sem mudar comportamento
404
- - return items.map(x => x).filter(x => x > 0) // Ineficiente
405
- + return items.filter(x => x > 0) // Otimizado
406
-
407
- // ✅ Corrigir edge cases
408
- - if (array.length) return array[0] // Falha se length = 0
409
- + if (array.length > 0) return array[0]
410
- ```
411
-
412
- **Quando usar:** Sempre que consertar algo que não estava funcionando corretamente.
413
-
414
- #### 🎯 Decisão Rápida: Qual versão usar?
415
-
416
- ```
417
- Quebra código existente?
418
- ├─ SIM → 🔴 MAJOR (X.0.0)
419
- └─ NÃO → Adiciona nova funcionalidade?
420
- ├─ SIM → 🟡 MINOR (x.Y.0)
421
- └─ NÃO → 🟢 PATCH (x.y.Z)
422
- ```
423
-
424
- #### 💡 Dicas Práticas
425
-
426
- 1. **Na dúvida entre MINOR e PATCH:**
427
-
428
- - Se adiciona qualquer coisa nova (função, parâmetro, propriedade) → MINOR
429
- - Se apenas corrige comportamento → PATCH
430
-
431
- 2. **Evite MAJOR sempre que possível:**
432
-
433
- - Use `@deprecated` para marcar código antigo
434
- - Mantenha compatibilidade por 1-2 versões MINOR antes de remover
435
-
436
- 3. **Pre-releases (0.x.x):**
245
+ \`\`\`bash
246
+ git commit -m "feat: add new export functionality"
247
+ version-control
437
248
 
438
- - Versões 0.x.x podem fazer breaking changes em MINOR
439
- - Use antes do 1.0.0 para desenvolvimento inicial
249
+ # Current version: 1.2.3
250
+ # Suggested type: MINOR
251
+ # New version: 1.3.0
252
+ #
253
+ # Update version? (y/n): y
254
+ #
255
+ # ✓ package.json updated
256
+ # ✓ CHANGELOG.md updated
257
+ # ✓ Tag v1.3.0 created
258
+ # ✓ Version 1.3.0 published!
259
+ \`\`\`
440
260
 
441
- 4. **Versão 1.0.0:**
442
- - Representa a primeira versão estável
443
- - A partir dela, siga SemVer rigorosamente
261
+ ## 📚 API
444
262
 
445
- ## 📖 Exemplos
263
+ ### Available Methods
446
264
 
447
- ### Fluxo Típico
265
+ #### Analysis and Versioning
448
266
 
449
- ```bash
450
- # 1. Faça suas alterações
451
- vim src/index.ts
267
+ - \`analyzeChanges()\` - Analyzes last commit and suggests version type
268
+ - \`getCurrentVersion(projectRoot?)\` - Returns current version from package.json
269
+ - \`bumpVersion(currentVersion, type)\` - Calculates new version
452
270
 
453
- # 2. Commit suas mudanças
454
- git commit -m "feat: add new export functionality"
271
+ #### File Updates
455
272
 
456
- # 3. Execute o version control
457
- version-control
273
+ - \`updatePackageJson(newVersion, projectRoot?)\` - Updates package.json
274
+ - \`updateIndexFile(newVersion, projectRoot?)\` - Updates @version in code files
275
+ - \`updateChangelog(version, type, analysis, projectRoot?)\` - Updates CHANGELOG.md
458
276
 
459
- # Output:
460
- # ═══════════════════════════════════════════════════════════
461
- # Sistema de Controle de Versão
462
- # ═══════════════════════════════════════════════════════════
463
- #
464
- # Versão atual: 1.2.3
465
- #
466
- # Analisando último commit...
467
- #
468
- # Mensagem do commit:
469
- # "feat: add new export functionality"
470
- #
471
- # Arquivos modificados: 2
472
- # - src/index.ts
473
- # - src/exporter.ts
474
- #
475
- # Análise da mudança:
476
- # 🟡 Commit indica nova funcionalidade
477
- #
478
- # Tipo sugerido: 🟡 MINOR
479
- # Nova versão: 1.2.3 → 1.3.0
480
- #
481
- # Deseja atualizar a versão? (s/n): s
482
- #
483
- # Confirme o tipo de versão:
484
- # 1 - MAJOR (2.0.0) - Breaking changes
485
- # 2 - MINOR (1.3.0) - Nova funcionalidade
486
- # 3 - PATCH (1.2.4) - Correção de bug
487
- #
488
- # Escolha (1/2/3) [padrão: 2]:
489
- #
490
- # Atualizando arquivos...
491
- # ✓ package.json atualizado
492
- # ✓ CHANGELOG.md atualizado
493
- #
494
- # ✓ Versão atualizada para 1.3.0!
495
- #
496
- # Executando comandos git...
497
- # → git add -A
498
- # ✓ Arquivos adicionados
499
- # → git commit -m "chore: bump version to 1.3.0"
500
- # ✓ Commit criado
501
- # → git tag v1.3.0
502
- # ✓ Tag criada
503
- # → git push
504
- # ✓ Push realizado
505
- # → git push --tags
506
- # ✓ Tags enviadas
507
- #
508
- # ✓ Versão 1.3.0 publicada com sucesso!
509
- ```
277
+ #### Commit and Git
510
278
 
511
- ### Personalizando a Escolha
279
+ - \`executeGitCommands(version)\` - Creates commit, tag, and pushes
280
+ - \`getStagedChanges()\` - Lists staged files
281
+ - \`generateCommitMessage(changes)\` - Generates automatic commit message
512
282
 
513
- Você pode escolher um tipo diferente do sugerido:
283
+ #### Configuration
514
284
 
515
- ```bash
516
- version-control
285
+ - \`getConfiguredLanguage()\` - Returns configured language
286
+ - \`setLanguage(lang)\` - Sets language manually
287
+ - \`clearConfig()\` - Removes configuration
517
288
 
518
- # O sistema sugere PATCH, mas você quer MINOR
519
- # Escolha (1/2/3) [padrão: 3]: 2
520
- ```
289
+ ---
521
290
 
522
- ## 📚 API
291
+ ### Details
523
292
 
524
- ### `analyzeChanges(): ChangeAnalysis`
293
+ #### \`analyzeChanges(): ChangeAnalysis\`
525
294
 
526
- Analisa o último commit e retorna uma análise das mudanças.
295
+ Analyzes the last commit and returns an analysis of the changes.
527
296
 
528
- **Retorno:**
297
+ **Returns:**
529
298
 
530
- ```typescript
299
+ \`\`\`typescript
531
300
  interface ChangeAnalysis {
532
301
  type: "major" | "minor" | "patch";
533
302
  reason: string[];
534
303
  filesChanged: string[];
535
304
  commitMsg: string;
536
305
  }
537
- ```
306
+ \`\`\`
538
307
 
539
- ### `getCurrentVersion(projectRoot?: string): string`
308
+ #### \`getCurrentVersion(projectRoot?: string): string\`
540
309
 
541
- Retorna a versão atual do `package.json`.
310
+ Returns the current version from \`package.json\`.
542
311
 
543
- **Parâmetros:**
312
+ **Parameters:**
544
313
 
545
- - `projectRoot` (opcional): Caminho raiz do projeto (padrão: `process.cwd()`)
314
+ - \`projectRoot\` (optional): Project root path (default: \`process.cwd()\`)
546
315
 
547
- ### `bumpVersion(currentVersion: string, type: VersionType): string`
316
+ #### \`bumpVersion(currentVersion: string, type: VersionType): string\`
548
317
 
549
- Calcula a nova versão baseado no tipo de bump.
318
+ Calculates the new version based on the bump type.
550
319
 
551
- **Parâmetros:**
320
+ **Parameters:**
552
321
 
553
- - `currentVersion`: Versão atual (ex: "1.2.3")
554
- - `type`: Tipo de bump (`'major'`, `'minor'`, ou `'patch'`)
322
+ - \`currentVersion\`: Current version (e.g., "1.2.3")
323
+ - \`type\`: Bump type (\`'major'\`, \`'minor'\`, or \`'patch'\`)
555
324
 
556
- **Exemplo:**
325
+ **Example:**
557
326
 
558
- ```typescript
327
+ \`\`\`typescript
559
328
  bumpVersion("1.2.3", "major"); // "2.0.0"
560
329
  bumpVersion("1.2.3", "minor"); // "1.3.0"
561
330
  bumpVersion("1.2.3", "patch"); // "1.2.4"
562
- ```
331
+ \`\`\`
563
332
 
564
- ## Internacionalização
333
+ ## 🌍 Internationalization
565
334
 
566
- A ferramenta detecta automaticamente o idioma do sistema e ajusta todas as mensagens de acordo.
335
+ The tool automatically detects the system language and adjusts all messages accordingly.
567
336
 
568
- ### Idiomas Suportados
337
+ ### Supported Languages
569
338
 
570
- - 🇬🇧 **Inglês (EN)** - Default
571
- - 🇧🇷 **Português (PT)** - pt_BR, pt_PT
572
- - 🇪🇸 **Espanhol (ES)** - es_ES, es_MX, etc.
573
- - 🇫🇷 **Francês (FR)** - fr_FR, fr_CA, etc.
339
+ - 🇬🇧 **English (EN)** - Default
340
+ - 🇧🇷 **Portuguese (PT)** - pt_BR, pt_PT
341
+ - 🇪🇸 **Spanish (ES)** - es_ES, es_MX, etc.
342
+ - 🇫🇷 **French (FR)** - fr_FR, fr_CA, etc.
574
343
 
575
- ### Configurar Idioma Manualmente
344
+ ### Manual Language Configuration
576
345
 
577
- ```bash
578
- # Configurar para português
346
+ \`\`\`bash
347
+ # Configure to Portuguese
579
348
  version-control config --lang pt
580
349
 
581
- # Configurar para inglês
350
+ # Configure to English
582
351
  version-control config --lang en
583
352
 
584
- # Configurar para espanhol
353
+ # Configure to Spanish
585
354
  version-control config --lang es
586
355
 
587
- # Configurar para francês
356
+ # Configure to French
588
357
  version-control config --lang fr
589
358
 
590
- # Limpar configuração (volta a usar detecção automática)
359
+ # Clear configuration (returns to automatic detection)
591
360
  version-control config --clear
592
361
 
593
- # Ver configuração atual
362
+ # View current configuration
594
363
  version-control config
595
- ```
596
-
597
- A configuração é salva globalmente em `~/.version-control-config.json` e será usada em todos os projetos.
598
-
599
- ### Como Funciona
600
-
601
- 1. **Configuração Manual**: Se você configurou um idioma com `version-control config --lang`, ele será usado
602
- 2. **Detecção Automática**: Se não houver configuração, detecta do sistema via `LANG`, `LANGUAGE`, `LC_ALL`
603
- 3. **Fallback**: Se o idioma não for suportado, usa inglês automaticamente
604
-
605
- **Indicador de Idioma:**
606
-
607
- Toda vez que você executar `version-control` ou `smart-commit`, verá uma linha informando:
608
-
609
- ```bash
610
- ℹ Current language: PT (manually configured)
611
- To change language: version-control config --lang <code>
612
- ```
613
-
614
- ou
615
-
616
- ```bash
617
- ℹ Idioma atual: PT (detectado do sistema)
618
- Para mudar o idioma: version-control config --lang <code>
619
- ```
620
-
621
- ### Detecção Automática do Sistema
622
-
623
- A detecção é automática baseada nas variáveis de ambiente do sistema:
364
+ \`\`\`
624
365
 
625
- - `LANG`
626
- - `LANGUAGE`
627
- - `LC_ALL`
366
+ The configuration is saved globally in \`~/.version-control-config.json\` and will be used in all projects.
628
367
 
629
- **Exemplo:**
368
+ ## 🎯 Keywords
630
369
 
631
- ```bash
632
- # Sistema em português
633
- LANG=pt_BR.UTF-8 version-control
634
- # Output: "Versão atual: 1.0.0"
635
- # Output: "Deseja atualizar a versão? (s/n):"
370
+ - **MAJOR**: \`breaking\`, \`remove\`, \`delete\`, \`rewrite\`
371
+ - **MINOR**: \`add\`, \`new\`, \`feature\`, \`implement\`
372
+ - **PATCH**: \`fix\`, \`bug\`, \`error\`
636
373
 
637
- # Sistema em inglês
638
- LANG=en_US.UTF-8 version-control
639
- # Output: "Current version: 1.0.0"
640
- # Output: "Update version? (y/n):"
374
+ ## 🤝 Contributing
641
375
 
642
- # Sistema em espanhol
643
- LANG=es_ES.UTF-8 version-control
644
- # Output: "Versión actual: 1.0.0"
645
- # Output: "¿Actualizar versión? (s/n):"
376
+ Contributions are welcome! Feel free to:
646
377
 
647
- # Sistema em francês
648
- LANG=fr_FR.UTF-8 version-control
649
- # Output: "Version actuelle: 1.0.0"
650
- # Output: "Mettre à jour la version? (o/n):"
651
- ```
378
+ 1. Fork the project
379
+ 2. Create a branch for your feature (\`git checkout -b feature/AmazingFeature\`)
380
+ 3. Commit your changes (\`git commit -m 'feat: add some AmazingFeature'\`)
381
+ 4. Push to the branch (\`git push origin feature/AmazingFeature\`)
382
+ 5. Open a Pull Request
652
383
 
653
- ### Idiomas Não Suportados
384
+ ## 📄 License
654
385
 
655
- Se o idioma do sistema não for um dos 4 suportados, a ferramenta **automaticamente usa inglês** como fallback.
386
+ This project is under the MIT license. See the [LICENSE](LICENSE) file for more details.
656
387
 
657
- ```bash
658
- # Sistema em alemão (não suportado)
659
- LANG=de_DE.UTF-8 version-control
660
- # Output em inglês: "Current version: 1.0.0"
661
- ```
662
-
663
- ## �🎨 Palavras-chave Reconhecidas
664
-
665
- ### Breaking Changes (MAJOR)
666
-
667
- - `breaking`, `break`
668
- - `incompatível`, `incompatible`
669
- - `remove`, `remov`, `delete`, `delet`
670
- - `refactor completo`, `reescrita`, `rewrite`
671
-
672
- ### Novas Funcionalidades (MINOR)
673
-
674
- - `add`, `adicion`
675
- - `nova`, `novo`, `new`
676
- - `feature`, `implement`
677
- - `criar`, `create`, `funcionalidade`
678
-
679
- ### Correções (PATCH)
680
-
681
- - `fix`, `corrig`
682
- - `bug`, `erro`, `error`
683
- - `ajust`, `ajeit`, `pequen`
684
- - `minor change`
685
-
686
- ## 🤝 Contribuindo
687
-
688
- Contribuições são bem-vindas! Sinta-se à vontade para:
689
-
690
- 1. Fazer fork do projeto
691
- 2. Criar uma branch para sua feature (`git checkout -b feature/AmazingFeature`)
692
- 3. Commit suas mudanças (`git commit -m 'feat: add some AmazingFeature'`)
693
- 4. Push para a branch (`git push origin feature/AmazingFeature`)
694
- 5. Abrir um Pull Request
695
-
696
- ## 📄 Licença
697
-
698
- Este projeto está sob a licença MIT. Veja o arquivo [LICENSE](LICENSE) para mais detalhes.
699
-
700
- ## 👤 Autor
388
+ ## 👤 Author
701
389
 
702
390
  **Ridio Ricardo**
703
391
 
704
392
  - GitHub: [@ridioricardo](https://github.com/ridioricardo)
705
393
 
706
- ## 🙏 Agradecimentos
707
-
708
- - Inspirado nas melhores práticas de versionamento semântico
709
- - Construído com TypeScript para melhor experiência de desenvolvimento
710
- - Baseado nas especificações do [Semantic Versioning 2.0.0](https://semver.org/)
711
-
712
394
  ---
713
395
 
714
- Se este projeto foi útil para você, considere dar uma estrela no GitHub!
396
+ Based on [Semantic Versioning 2.0.0](https://semver.org/) specifications