@elsikora/commitizen-plugin-commitlint-ai 2.0.0-dev.2 → 2.0.1-dev.1
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,349 +1,313 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://6jft62zmy9nx2oea.public.blob.vercel-storage.com/commitizen-plugin-commitlint-ai-
|
|
2
|
+
<img src="https://6jft62zmy9nx2oea.public.blob.vercel-storage.com/commitizen-plugin-commitlint-ai-5z2uE7Wo3HXxhEkaeQQmNYyl3eWvjM.png" width="500" alt="project-logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center"
|
|
6
|
-
<p align="center"><em>AI-powered
|
|
5
|
+
<h1 align="center">🤖 Commitizen Plugin Commitlint AI</h1>
|
|
6
|
+
<p align="center"><em>Transform your Git workflow with AI-powered commit messages that follow conventional standards and pass Commitlint validation every time</em></p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a aria-label="ElsiKora logo" href="https://elsikora.com">
|
|
10
10
|
<img src="https://img.shields.io/badge/MADE%20BY%20ElsiKora-333333.svg?style=for-the-badge" alt="ElsiKora">
|
|
11
|
-
</a> <img src="https://img.shields.io/badge/
|
|
11
|
+
</a> <img src="https://img.shields.io/badge/TypeScript-3178C6.svg?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript"> <img src="https://img.shields.io/badge/Node.js-339933.svg?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"> <img src="https://img.shields.io/badge/npm-CB3837.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"> <img src="https://img.shields.io/badge/Git-F05032.svg?style=for-the-badge&logo=git&logoColor=white" alt="Git"> <img src="https://img.shields.io/badge/OpenAI-412991.svg?style=for-the-badge&logo=openai&logoColor=white" alt="OpenAI"> <img src="https://img.shields.io/badge/ESLint-4B32C3.svg?style=for-the-badge&logo=eslint&logoColor=white" alt="ESLint"> <img src="https://img.shields.io/badge/Prettier-F7B93E.svg?style=for-the-badge&logo=prettier&logoColor=black" alt="Prettier"> <img src="https://img.shields.io/badge/Vitest-6E9F18.svg?style=for-the-badge&logo=vitest&logoColor=white" alt="Vitest"> <img src="https://img.shields.io/badge/Rollup-EC4A3F.svg?style=for-the-badge&logo=rollup&logoColor=white" alt="Rollup">
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
-
## 📚 Table of Contents
|
|
15
14
|
|
|
15
|
+
## 📚 Table of Contents
|
|
16
16
|
- [Description](#-description)
|
|
17
17
|
- [Features](#-features)
|
|
18
|
-
- [Architecture](#-architecture)
|
|
19
18
|
- [Installation](#-installation)
|
|
20
19
|
- [Usage](#-usage)
|
|
21
|
-
- [Configuration](#-configuration)
|
|
22
20
|
- [Roadmap](#-roadmap)
|
|
23
21
|
- [FAQ](#-faq)
|
|
24
22
|
- [License](#-license)
|
|
25
23
|
|
|
26
|
-
## 📖 Description
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
## 📖 Description
|
|
26
|
+
Commitizen Plugin Commitlint AI revolutionizes the way developers write commit messages by combining the power of artificial intelligence with strict conventional commit standards. Built with clean architecture principles, this plugin seamlessly integrates with your existing Commitizen workflow to generate meaningful, context-aware commit messages that adhere to your project's Commitlint rules.
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Whether you're working on a solo project or collaborating in a large team, this tool eliminates the cognitive overhead of crafting perfect commit messages while maintaining a consistent, high-quality Git history. It supports multiple AI providers including OpenAI's GPT-4.1, Anthropic's Claude 4, Google's Gemini 2.5, and even local models through Ollama.
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
- ✨ **Full integration with Commitlint rules and configuration**
|
|
34
|
-
- ✨ **Flexible configuration with Cosmiconfig support**
|
|
35
|
-
- ✨ **Environment variable support for API keys (prioritized over config)**
|
|
36
|
-
- ✨ **Automatic model migration for deprecated models**
|
|
37
|
-
- ✨ **Configurable retry mechanism for generation and validation**
|
|
38
|
-
- ✨ **Support for both manual and automatic commit modes**
|
|
39
|
-
- ✨ **Smart scope detection based on changed files**
|
|
40
|
-
- ✨ **Breaking change detection and documentation**
|
|
41
|
-
- ✨ **Interactive commit message confirmation with validation**
|
|
42
|
-
- ✨ **Clean architecture with dependency injection**
|
|
43
|
-
- ✨ **Real-time retry status updates in the UI**
|
|
44
|
-
- ✨ **Supports latest AI models including GPT-4.1 and Claude 4**
|
|
45
|
-
- ✨ **Fallback to manual mode if AI generation fails**
|
|
30
|
+
The plugin intelligently analyzes your staged changes, understands the context of your modifications, and generates commit messages that not only follow the conventional format but also provide meaningful descriptions of the changes. With automatic validation and smart retry mechanisms, it ensures every commit message meets your project's standards.
|
|
46
31
|
|
|
47
|
-
##
|
|
32
|
+
## 🚀 Features
|
|
33
|
+
- ✨ **🤖 **AI-Powered Generation** - Leverage GPT-4.1, Claude 4, Gemini 2.5, and more to create contextually relevant commit messages**
|
|
34
|
+
- ✨ **✅ **Commitlint Integration** - Automatically validates and fixes messages to comply with your project's Commitlint rules**
|
|
35
|
+
- ✨ **🔄 **Smart Retry Mechanism** - Intelligently retries generation and validation with configurable attempts**
|
|
36
|
+
- ✨ **🎯 **Clean Architecture** - Built with SOLID principles, dependency injection, and clear separation of concerns**
|
|
37
|
+
- ✨ **🌐 **Multi-Provider Support** - Choose from OpenAI, Anthropic, Google, Azure, AWS Bedrock, or local Ollama models**
|
|
38
|
+
- ✨ **🛡️ **Type-Safe** - Fully typed with TypeScript for enhanced developer experience and reliability**
|
|
39
|
+
- ✨ **⚡ **Flexible Configuration** - Cosmiconfig support for easy setup via JSON, YAML, or JavaScript**
|
|
40
|
+
- ✨ **🔐 **Secure API Key Handling** - Environment variable support with session-based key input options**
|
|
41
|
+
- ✨ **📝 **Manual Mode Fallback** - Seamlessly switch to guided manual entry when needed**
|
|
42
|
+
- ✨ **🚀 **Breaking Change Detection** - Automatically identifies and documents breaking changes**
|
|
48
43
|
|
|
49
|
-
|
|
44
|
+
## 🛠 Installation
|
|
45
|
+
```bash
|
|
46
|
+
# Install the plugin as a dev dependency
|
|
47
|
+
npm install --save-dev @elsikora/commitizen-plugin-commitlint-ai
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
# Initialize Commitizen with this adapter
|
|
50
|
+
npx commitizen init @elsikora/commitizen-plugin-commitlint-ai --save-dev --save-exact
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
# Install Commitlint (if not already installed)
|
|
53
|
+
npm install --save-dev @commitlint/cli @commitlint/config-conventional
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
# Create a commitlint config file
|
|
56
|
+
echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
|
|
57
|
+
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## 💡 Usage
|
|
60
|
+
## Basic Usage
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
- Interfaces: `ILLMService`, `ICommitValidator`, `IConfigService`, etc.
|
|
62
|
+
### Quick Start
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
```bash
|
|
65
|
+
# Stage your changes
|
|
66
|
+
git add .
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
# Run the AI-powered commit wizard
|
|
69
|
+
git cz
|
|
70
|
+
# or
|
|
71
|
+
npm run commit
|
|
72
|
+
```
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
- `CommitizenAdapter` as the main entry point
|
|
74
|
+
### Configuration Methods
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
The plugin supports multiple configuration approaches:
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## 🛠 Installation
|
|
78
|
+
#### 1. Environment Variables (Recommended)
|
|
78
79
|
|
|
79
80
|
```bash
|
|
80
|
-
#
|
|
81
|
-
|
|
81
|
+
# .env file
|
|
82
|
+
OPENAI_API_KEY=sk-...
|
|
83
|
+
# or
|
|
84
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
85
|
+
# or
|
|
86
|
+
GOOGLE_API_KEY=AIza...
|
|
87
|
+
# or (Azure OpenAI)
|
|
88
|
+
AZURE_OPENAI_API_KEY=https://your-resource.openai.azure.com|your-api-key|your-deployment-name
|
|
89
|
+
# or (AWS Bedrock)
|
|
90
|
+
AWS_BEDROCK_API_KEY=us-east-1|access-key-id|secret-access-key
|
|
91
|
+
# or (Ollama)
|
|
92
|
+
OLLAMA_API_KEY=localhost:11434|llama3.2
|
|
93
|
+
```
|
|
82
94
|
|
|
83
|
-
|
|
84
|
-
yarn add -D @elsikora/commitizen-plugin-commitlint-ai
|
|
95
|
+
#### 2. Configuration File
|
|
85
96
|
|
|
86
|
-
|
|
87
|
-
pnpm add -D @elsikora/commitizen-plugin-commitlint-ai
|
|
97
|
+
Create `.elsikora/commitlint-ai.config.js`:
|
|
88
98
|
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
```javascript
|
|
100
|
+
export default {
|
|
101
|
+
provider: 'openai',
|
|
102
|
+
model: 'gpt-4.1',
|
|
103
|
+
mode: 'auto',
|
|
104
|
+
maxRetries: 3,
|
|
105
|
+
validationMaxRetries: 3
|
|
106
|
+
};
|
|
91
107
|
```
|
|
92
108
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Basic Usage
|
|
109
|
+
#### 3. Package.json
|
|
96
110
|
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"elsikora": {
|
|
114
|
+
"commitlint-ai": {
|
|
115
|
+
"provider": "anthropic",
|
|
116
|
+
"model": "claude-opus-4-20250514",
|
|
117
|
+
"mode": "auto"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
101
121
|
```
|
|
102
122
|
|
|
103
|
-
|
|
123
|
+
### Commit Modes
|
|
104
124
|
|
|
105
|
-
|
|
106
|
-
2. If auto mode and no API key is configured, guide you through configuration
|
|
107
|
-
3. Generate or help you write a commit message
|
|
108
|
-
4. Validate against your commitlint rules
|
|
109
|
-
5. Allow you to confirm or edit before committing
|
|
125
|
+
#### Auto Mode (AI-Powered)
|
|
110
126
|
|
|
111
|
-
|
|
127
|
+
The AI analyzes your changes and generates appropriate commit messages:
|
|
112
128
|
|
|
113
129
|
```bash
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
$ git cz
|
|
131
|
+
✔ Using AI-powered commit mode...
|
|
132
|
+
✔ AI generated initial commit message
|
|
133
|
+
✔ AI generated commit message successfully!
|
|
134
|
+
|
|
135
|
+
┌─────────────────────────────────┐
|
|
136
|
+
│ Generated commit message: │
|
|
137
|
+
├─────────────────────────────────┤
|
|
138
|
+
│ feat(auth): implement OAuth2 │
|
|
139
|
+
│ │
|
|
140
|
+
│ Added OAuth2 authentication │
|
|
141
|
+
│ flow with JWT token support. │
|
|
142
|
+
│ Includes refresh token logic │
|
|
143
|
+
│ and secure session management. │
|
|
144
|
+
│ │
|
|
145
|
+
│ BREAKING CHANGE: Auth API │
|
|
146
|
+
│ endpoints have been updated │
|
|
147
|
+
└─────────────────────────────────┘
|
|
148
|
+
|
|
149
|
+
✔ Do you want to proceed with this commit message? (Y/n)
|
|
126
150
|
```
|
|
127
151
|
|
|
128
|
-
|
|
152
|
+
#### Manual Mode
|
|
129
153
|
|
|
130
|
-
|
|
154
|
+
Guided commit message creation with validation:
|
|
131
155
|
|
|
132
|
-
|
|
156
|
+
```bash
|
|
157
|
+
$ git cz
|
|
158
|
+
✔ Using manual commit mode...
|
|
159
|
+
? Select commit type: (Use arrow keys)
|
|
160
|
+
❯ feat: A new feature ✨
|
|
161
|
+
fix: A bug fix 🐛
|
|
162
|
+
docs: Documentation only changes 📚
|
|
163
|
+
style: Code style changes 🎨
|
|
164
|
+
refactor: Code refactoring 📦
|
|
165
|
+
perf: Performance improvements 🚀
|
|
166
|
+
test: Adding tests 🚨
|
|
167
|
+
|
|
168
|
+
? Enter scope (optional): auth
|
|
169
|
+
? Enter commit subject: add login functionality
|
|
170
|
+
? Enter commit body (optional):
|
|
171
|
+
? Is this a breaking change? No
|
|
172
|
+
```
|
|
133
173
|
|
|
134
|
-
###
|
|
174
|
+
### Advanced Features
|
|
135
175
|
|
|
136
|
-
|
|
176
|
+
#### Custom Instructions
|
|
137
177
|
|
|
138
|
-
-
|
|
139
|
-
- `.commitlintairc.json`
|
|
140
|
-
- `.commitlintairc.yaml`
|
|
141
|
-
- `.commitlintairc.yml`
|
|
142
|
-
- `.commitlintairc.js`
|
|
143
|
-
- `.commitlintairc.cjs`
|
|
144
|
-
- `commitlintai.config.js`
|
|
145
|
-
- `commitlintai.config.cjs`
|
|
146
|
-
- `package.json` (under `"commitlintai"` key)
|
|
178
|
+
Provide project-specific guidance to the AI:
|
|
147
179
|
|
|
148
|
-
|
|
180
|
+
```javascript
|
|
181
|
+
// commitlint-ai.config.js
|
|
182
|
+
export default {
|
|
183
|
+
provider: 'openai',
|
|
184
|
+
model: 'gpt-4.1',
|
|
185
|
+
instructions: 'Focus on business impact and user-facing changes. Use present tense.'
|
|
186
|
+
};
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Retry Configuration
|
|
149
190
|
|
|
150
191
|
```javascript
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
provider: "openai",
|
|
155
|
-
|
|
156
|
-
// Model to use (auto-migrates deprecated models)
|
|
157
|
-
model: "gpt-4o",
|
|
158
|
-
|
|
159
|
-
// Mode: 'auto' or 'manual'
|
|
160
|
-
mode: "auto",
|
|
161
|
-
|
|
162
|
-
// API key (optional - env vars recommended)
|
|
163
|
-
// Format varies by provider:
|
|
164
|
-
// - OpenAI/Anthropic/Google: 'your-api-key'
|
|
165
|
-
// - Azure OpenAI: 'endpoint|api-key|deployment-name'
|
|
166
|
-
// - AWS Bedrock: 'region|access-key-id|secret-access-key'
|
|
167
|
-
// - Ollama: 'host:port' or 'host:port|custom-model-name'
|
|
168
|
-
apiKey: "your-api-key",
|
|
169
|
-
|
|
170
|
-
// Retry configuration
|
|
171
|
-
maxGenerationRetries: 3,
|
|
172
|
-
maxValidationRetries: 3,
|
|
173
|
-
|
|
174
|
-
// Custom instructions for AI
|
|
175
|
-
instructions: "Focus on user-facing changes",
|
|
192
|
+
export default {
|
|
193
|
+
maxRetries: 5, // AI generation retries
|
|
194
|
+
validationMaxRetries: 3 // Validation fix attempts
|
|
176
195
|
};
|
|
177
196
|
```
|
|
178
197
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
- `claude-3-opus-latest` (Complex tasks)
|
|
204
|
-
|
|
205
|
-
### Google (Gemini)
|
|
206
|
-
|
|
207
|
-
- `gemini-2.5-pro` (Latest 2025, most capable)
|
|
208
|
-
- `gemini-2.5-flash` (Latest 2025, fast)
|
|
209
|
-
- `gemini-2.0-flash-exp` (Experimental)
|
|
210
|
-
- `gemini-1.5-pro` (Stable, capable)
|
|
211
|
-
- `gemini-1.5-flash` (Fast, stable)
|
|
212
|
-
- `gemini-1.5-flash-8b` (Lightweight)
|
|
213
|
-
- `gemini-1.0-pro`
|
|
214
|
-
|
|
215
|
-
### Google (Gemma - Open Models for Vertex AI)
|
|
216
|
-
|
|
217
|
-
- `gemma-3-27b` (Most capable open model)
|
|
218
|
-
- `gemma-3-12b` (Strong language capabilities)
|
|
219
|
-
- `gemma-3-4b` (Balanced, multimodal support)
|
|
220
|
-
- `gemma-3-1b` (Lightweight for edge deployment)
|
|
221
|
-
|
|
222
|
-
### Azure OpenAI
|
|
223
|
-
|
|
224
|
-
- `gpt-4.1-turbo-2024-12-17` (Latest 2025, most capable)
|
|
225
|
-
- `gpt-4.1-preview-2024-12-17` (Latest preview)
|
|
226
|
-
- `gpt-4.1-mini-2024-12-17` (Fast 4.1 model)
|
|
227
|
-
- `gpt-4o-2024-11-20` (Enhanced creative)
|
|
228
|
-
- `gpt-4o-mini-2024-07-18`
|
|
229
|
-
- `gpt-4-turbo`
|
|
230
|
-
- `gpt-3.5-turbo`
|
|
231
|
-
- `o3-2024-12-17` (Enhanced reasoning)
|
|
232
|
-
- `o4-mini-2024-12-17` (Fast reasoning)
|
|
233
|
-
|
|
234
|
-
### AWS Bedrock
|
|
235
|
-
|
|
236
|
-
- `anthropic.claude-opus-4-20250514-v1:0` (Claude Opus 4 - Latest 2025, most capable)
|
|
237
|
-
- `anthropic.claude-sonnet-4-20250514-v1:0` (Claude Sonnet 4 - Latest 2025, balanced)
|
|
238
|
-
- `anthropic.claude-3-5-sonnet-20241022-v2:0` (Claude 3.5 Sonnet v2)
|
|
239
|
-
- `anthropic.claude-3-5-haiku-20241022-v1:0` (Fast)
|
|
240
|
-
- `anthropic.claude-3-5-sonnet-20240620-v1:0`
|
|
241
|
-
- `us.amazon.nova-pro-v1:0` (Latest Amazon model)
|
|
242
|
-
- `us.deepseek.deepseek-r1:0` (Advanced reasoning)
|
|
243
|
-
- `us.meta.llama3-2-90b-instruct-v1:0` (Open source)
|
|
244
|
-
- `mistral.mistral-large-2411-v1:0` (Latest Mistral)
|
|
245
|
-
|
|
246
|
-
### Ollama (Local Models)
|
|
247
|
-
|
|
248
|
-
- `llama3.2` (Latest Llama)
|
|
249
|
-
- `llama3.1`
|
|
250
|
-
- `llama3`
|
|
251
|
-
- `mistral`
|
|
252
|
-
- `codellama`
|
|
253
|
-
- `deepseek-coder`
|
|
254
|
-
- `custom` (specify any Ollama model)
|
|
255
|
-
|
|
256
|
-
### Commitlint Configuration
|
|
198
|
+
#### Provider-Specific Setup
|
|
199
|
+
|
|
200
|
+
**Azure OpenAI:**
|
|
201
|
+
```bash
|
|
202
|
+
AZURE_OPENAI_API_KEY=https://myresource.openai.azure.com|api-key|gpt-4-deployment
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**AWS Bedrock:**
|
|
206
|
+
```bash
|
|
207
|
+
AWS_BEDROCK_API_KEY=us-west-2|AKIAIOSFODNN7EXAMPLE|wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Ollama (Local):**
|
|
211
|
+
```bash
|
|
212
|
+
# Default setup
|
|
213
|
+
OLLAMA_API_KEY=localhost:11434
|
|
214
|
+
|
|
215
|
+
# Custom model
|
|
216
|
+
OLLAMA_API_KEY=localhost:11434|codellama
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Commitlint Integration
|
|
220
|
+
|
|
221
|
+
The plugin respects all your Commitlint rules:
|
|
257
222
|
|
|
258
223
|
```javascript
|
|
259
224
|
// commitlint.config.js
|
|
260
225
|
export default {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
226
|
+
extends: ['@commitlint/config-conventional'],
|
|
227
|
+
rules: {
|
|
228
|
+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor']],
|
|
229
|
+
'scope-case': [2, 'always', 'lower-case'],
|
|
230
|
+
'subject-max-length': [2, 'always', 72],
|
|
231
|
+
'body-max-line-length': [2, 'always', 100]
|
|
232
|
+
}
|
|
268
233
|
};
|
|
269
234
|
```
|
|
270
235
|
|
|
271
|
-
###
|
|
236
|
+
### Troubleshooting
|
|
272
237
|
|
|
273
|
-
|
|
238
|
+
#### Force Manual Mode
|
|
274
239
|
|
|
275
240
|
```bash
|
|
276
|
-
# Create
|
|
241
|
+
# Create manual mode marker
|
|
277
242
|
mkdir -p .elsikora
|
|
278
243
|
touch .elsikora/manual
|
|
279
244
|
```
|
|
280
245
|
|
|
281
|
-
|
|
246
|
+
#### Clear Configuration Cache
|
|
282
247
|
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
"commitlintai": {
|
|
286
|
-
"provider": "anthropic",
|
|
287
|
-
"model": "claude-3-5-sonnet-20241022",
|
|
288
|
-
"mode": "auto",
|
|
289
|
-
"maxGenerationRetries": 5
|
|
290
|
-
}
|
|
291
|
-
}
|
|
248
|
+
```bash
|
|
249
|
+
rm -rf .elsikora/commitlint-ai.config.*
|
|
292
250
|
```
|
|
293
251
|
|
|
294
|
-
|
|
252
|
+
#### Debug Mode
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
DEBUG=commitizen-ai git cz
|
|
256
|
+
```
|
|
295
257
|
|
|
296
|
-
|
|
297
|
-
|
|
|
298
|
-
|
|
299
|
-
|
|
|
300
|
-
|
|
|
301
|
-
|
|
|
302
|
-
|
|
|
303
|
-
|
|
|
304
|
-
|
|
|
305
|
-
|
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
258
|
+
## 🛣 Roadmap
|
|
259
|
+
| Task / Feature | Status |
|
|
260
|
+
|----------------|--------|
|
|
261
|
+
| Core AI-powered commit generation | ✅ Done |
|
|
262
|
+
| Multi-provider support (OpenAI, Anthropic, Google) | ✅ Done |
|
|
263
|
+
| Commitlint rule integration | ✅ Done |
|
|
264
|
+
| Clean architecture implementation | ✅ Done |
|
|
265
|
+
| Automatic validation and fixing | ✅ Done |
|
|
266
|
+
| Environment variable support | ✅ Done |
|
|
267
|
+
| Cosmiconfig integration | ✅ Done |
|
|
268
|
+
| Interactive mode switching | ✅ Done |
|
|
269
|
+
| Breaking change detection | ✅ Done |
|
|
270
|
+
| AWS Bedrock and Azure OpenAI support | ✅ Done |
|
|
271
|
+
| Local Ollama model support | ✅ Done |
|
|
272
|
+
| Custom prompt templates | 🚧 In Progress |
|
|
273
|
+
| Multi-language commit messages | 🚧 In Progress |
|
|
274
|
+
| Git hook integration | 🚧 In Progress |
|
|
275
|
+
| VS Code extension | 🚧 In Progress |
|
|
276
|
+
| Team collaboration features | 🚧 In Progress |
|
|
277
|
+
| Commit message analytics | 🚧 In Progress |
|
|
278
|
+
| GitHub Copilot integration | 🚧 In Progress |
|
|
279
|
+
| Performance optimizations for monorepos | 🚧 In Progress |
|
|
315
280
|
|
|
316
281
|
## ❓ FAQ
|
|
282
|
+
**Q: Which AI providers are supported?**
|
|
283
|
+
A: The plugin supports OpenAI (GPT-4.1, GPT-4o), Anthropic (Claude 4, Claude 3.5), Google (Gemini 2.5), Azure OpenAI, AWS Bedrock, and local Ollama models. Each provider offers different models optimized for various use cases.
|
|
317
284
|
|
|
318
|
-
**Q: How does the AI
|
|
319
|
-
A: The plugin analyzes your git diff
|
|
285
|
+
**Q: How does the AI understand my code changes?**
|
|
286
|
+
A: The plugin analyzes your git diff, staged files, and file paths to understand the context. It then uses this information along with your Commitlint rules to generate appropriate conventional commit messages.
|
|
320
287
|
|
|
321
|
-
**Q:
|
|
322
|
-
A:
|
|
288
|
+
**Q: Is my code sent to AI services?**
|
|
289
|
+
A: Only the git diff and file names are sent to generate accurate commit messages. Full source code files are not transmitted unless they appear in the diff. For sensitive projects, consider using Ollama for local processing.
|
|
323
290
|
|
|
324
|
-
**Q:
|
|
325
|
-
A:
|
|
291
|
+
**Q: What happens if the AI service is unavailable?**
|
|
292
|
+
A: The plugin has a configurable retry mechanism with real-time status updates. If all retries fail, it automatically falls back to the guided manual mode, ensuring you can always create commits.
|
|
326
293
|
|
|
327
|
-
**Q:
|
|
328
|
-
A:
|
|
294
|
+
**Q: Can I customize the commit message format?**
|
|
295
|
+
A: Yes! The plugin fully respects your Commitlint configuration. You can define custom types, scopes, and rules. Additionally, you can provide custom instructions to guide the AI's generation style.
|
|
329
296
|
|
|
330
|
-
**Q: How do I switch between
|
|
331
|
-
A:
|
|
297
|
+
**Q: How do I switch between AI and manual modes?**
|
|
298
|
+
A: When you run `git cz`, you'll be prompted to choose your mode. You can also set a default mode in the configuration or create a `.elsikora/manual` file to force manual mode.
|
|
332
299
|
|
|
333
|
-
**Q:
|
|
334
|
-
A:
|
|
300
|
+
**Q: Is it safe to store API keys?**
|
|
301
|
+
A: The plugin prioritizes security by reading API keys from environment variables. Keys are never stored in configuration files. For added security, you can also input keys per session.
|
|
335
302
|
|
|
336
|
-
**Q:
|
|
337
|
-
A:
|
|
303
|
+
**Q: Can I use this with my existing Commitizen setup?**
|
|
304
|
+
A: Absolutely! This is a drop-in replacement for other Commitizen adapters. It works seamlessly with your existing Commitlint configuration and Git workflow.
|
|
338
305
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
- AWS Bedrock: `region|access-key-id|secret-access-key`
|
|
342
|
-
- Ollama: `host:port` or `host:port|custom-model-name`
|
|
306
|
+
**Q: What's the difference between generation and validation retries?**
|
|
307
|
+
A: Generation retries (`maxRetries`) handle AI service failures, while validation retries (`validationMaxRetries`) attempt to fix commit messages that don't pass Commitlint rules.
|
|
343
308
|
|
|
344
|
-
**Q:
|
|
345
|
-
A: The plugin
|
|
309
|
+
**Q: How much does it cost to use?**
|
|
310
|
+
A: The plugin itself is free and open-source. You'll need to pay for API usage with your chosen AI provider, or use free local models with Ollama.
|
|
346
311
|
|
|
347
312
|
## 🔒 License
|
|
348
|
-
|
|
349
|
-
This project is licensed under **MIT License**.
|
|
313
|
+
This project is licensed under **MIT License - see [LICENSE](LICENSE) file for details**.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { QualifiedRules, UserPromptConfig } from "@commitlint/types";
|
|
2
|
+
import type { ILlmPromptContext } from '../interface/llm-service.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Service for extracting LLM prompt context from commitlint configuration
|
|
5
|
+
*/
|
|
6
|
+
export declare class PromptContextExtractorService {
|
|
7
|
+
private readonly TYPE_ENUM_INDEX;
|
|
8
|
+
/**
|
|
9
|
+
* Extract LLM prompt context from commitlint rules and prompts
|
|
10
|
+
* @param {QualifiedRules} rules - The commitlint rules
|
|
11
|
+
* @param {UserPromptConfig} prompts - The user prompt configuration
|
|
12
|
+
* @returns {ILlmPromptContext} The extracted LLM prompt context
|
|
13
|
+
*/
|
|
14
|
+
extractContext(rules: QualifiedRules, prompts: UserPromptConfig): ILlmPromptContext;
|
|
15
|
+
/**
|
|
16
|
+
* Get API key prompt information based on provider
|
|
17
|
+
* @param {string} provider - The LLM provider name
|
|
18
|
+
* @returns {{ hint: string; prompt: string }} The hint and prompt text for API key input
|
|
19
|
+
*/
|
|
20
|
+
getApiKeyPromptInfo(provider: string): {
|
|
21
|
+
hint: string;
|
|
22
|
+
prompt: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { QualifiedRules, UserPromptConfig } from "@commitlint/types";
|
|
2
|
+
import type { ILlmPromptContext } from '../interface/llm-service.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Service for extracting LLM prompt context from commitlint configuration
|
|
5
|
+
*/
|
|
6
|
+
export declare class PromptContextExtractorService {
|
|
7
|
+
private readonly TYPE_ENUM_INDEX;
|
|
8
|
+
/**
|
|
9
|
+
* Extract LLM prompt context from commitlint rules and prompts
|
|
10
|
+
* @param {QualifiedRules} rules - The commitlint rules
|
|
11
|
+
* @param {UserPromptConfig} prompts - The user prompt configuration
|
|
12
|
+
* @returns {ILlmPromptContext} The extracted LLM prompt context
|
|
13
|
+
*/
|
|
14
|
+
extractContext(rules: QualifiedRules, prompts: UserPromptConfig): ILlmPromptContext;
|
|
15
|
+
/**
|
|
16
|
+
* Get API key prompt information based on provider
|
|
17
|
+
* @param {string} provider - The LLM provider name
|
|
18
|
+
* @returns {{ hint: string; prompt: string }} The hint and prompt text for API key input
|
|
19
|
+
*/
|
|
20
|
+
getApiKeyPromptInfo(provider: string): {
|
|
21
|
+
hint: string;
|
|
22
|
+
prompt: string;
|
|
23
|
+
};
|
|
24
|
+
}
|