@mehmetsagir/git-ai 0.0.9 → 0.0.18
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 +91 -319
- package/dist/commit.d.ts +1 -4
- package/dist/commit.d.ts.map +1 -1
- package/dist/commit.js +214 -208
- package/dist/commit.js.map +1 -1
- package/dist/config.d.ts +0 -39
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -95
- package/dist/config.js.map +1 -1
- package/dist/git.d.ts +19 -51
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +137 -269
- package/dist/git.js.map +1 -1
- package/dist/index.js +54 -109
- package/dist/index.js.map +1 -1
- package/dist/openai.d.ts +2 -21
- package/dist/openai.d.ts.map +1 -1
- package/dist/openai.js +17 -96
- package/dist/openai.js.map +1 -1
- package/dist/prompts.d.ts +2 -16
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +32 -146
- package/dist/prompts.js.map +1 -1
- package/dist/reset.d.ts +0 -3
- package/dist/reset.d.ts.map +1 -1
- package/dist/reset.js +10 -20
- package/dist/reset.js.map +1 -1
- package/dist/setup.d.ts +0 -3
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +28 -156
- package/dist/setup.js.map +1 -1
- package/dist/stash.d.ts +2 -0
- package/dist/stash.d.ts.map +1 -0
- package/dist/stash.js +818 -0
- package/dist/stash.js.map +1 -0
- package/dist/types.d.ts +9 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/hunk-parser.d.ts +22 -0
- package/dist/utils/hunk-parser.d.ts.map +1 -0
- package/dist/utils/hunk-parser.js +155 -0
- package/dist/utils/hunk-parser.js.map +1 -0
- package/package.json +8 -9
- package/dist/add.d.ts +0 -5
- package/dist/add.d.ts.map +0 -1
- package/dist/add.js +0 -98
- package/dist/add.js.map +0 -1
- package/dist/commit-processor.d.ts +0 -6
- package/dist/commit-processor.d.ts.map +0 -1
- package/dist/commit-processor.js +0 -226
- package/dist/commit-processor.js.map +0 -1
- package/dist/update.d.ts +0 -9
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js +0 -69
- package/dist/update.js.map +0 -1
- package/dist/user-management.d.ts +0 -10
- package/dist/user-management.d.ts.map +0 -1
- package/dist/user-management.js +0 -175
- package/dist/user-management.js.map +0 -1
- package/dist/users.d.ts +0 -9
- package/dist/users.d.ts.map +0 -1
- package/dist/users.js +0 -129
- package/dist/users.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -24
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -81
- package/dist/utils/validation.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,349 +1,105 @@
|
|
|
1
1
|
# Git AI
|
|
2
2
|
|
|
3
|
-
AI-powered git commit tool. Analyzes
|
|
3
|
+
AI-powered git commit tool. Analyzes changes, groups them logically, and creates commits in Conventional Commits format.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- **Smart Grouping**: Groups related files together by feature
|
|
8
|
+
- **Conventional Commits**: Uses standard commit message format (feat, fix, refactor, etc.)
|
|
9
|
+
- **All Changes Included**: Handles tracked, untracked, new, and deleted files
|
|
10
|
+
- **Safe**: Shows commit plan for approval before committing
|
|
11
|
+
- **Stash Viewer**: Browse git stashes in a web UI with syntax highlighting
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
### Global Installation
|
|
16
|
-
|
|
17
15
|
```bash
|
|
18
16
|
npm install -g @mehmetsagir/git-ai
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
git-ai setup
|
|
25
|
-
git-ai commit
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Using with npx (no installation required)
|
|
19
|
+
## Setup
|
|
29
20
|
|
|
30
21
|
```bash
|
|
31
|
-
npx @mehmetsagir/git-ai setup
|
|
32
|
-
npx @mehmetsagir/git-ai commit
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Initial Setup
|
|
36
|
-
|
|
37
|
-
Run the setup command on first use:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# If installed globally
|
|
41
22
|
git-ai setup
|
|
42
|
-
|
|
43
|
-
# Or with npx
|
|
44
|
-
npx @mehmetsagir/git-ai setup
|
|
45
23
|
```
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- Asks for your OpenAI API key
|
|
50
|
-
- Detects your git user profiles
|
|
51
|
-
- Allows you to select a default git user
|
|
52
|
-
- Saves configuration to `~/.git-ai/config.json`
|
|
25
|
+
Enter your OpenAI API key when prompted.
|
|
53
26
|
|
|
54
27
|
## Usage
|
|
55
28
|
|
|
56
|
-
### Creating Commits
|
|
57
|
-
|
|
58
|
-
**With default user:**
|
|
59
|
-
|
|
60
29
|
```bash
|
|
61
|
-
# If installed globally
|
|
62
30
|
git-ai commit
|
|
63
|
-
|
|
64
|
-
# Or with npx
|
|
65
|
-
npx @mehmetsagir/git-ai commit
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**With a different user:**
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Using shortcut (easiest method - single or multi-character)
|
|
72
|
-
git-ai commit --user my
|
|
73
|
-
git-ai commit --user g
|
|
74
|
-
git-ai commit --user work
|
|
75
|
-
git-ai commit -u personal
|
|
76
|
-
|
|
77
|
-
# Using email
|
|
78
|
-
git-ai commit --user user@example.com
|
|
79
|
-
|
|
80
|
-
# Using user ID (ID shown during setup)
|
|
81
|
-
git-ai commit --user global-user@example.com
|
|
82
31
|
```
|
|
83
32
|
|
|
84
|
-
|
|
33
|
+
The tool will:
|
|
34
|
+
1. Analyze all changes (staged, unstaged, and untracked)
|
|
35
|
+
2. Group related files by feature
|
|
36
|
+
3. Show commit plan for approval
|
|
37
|
+
4. Create commits
|
|
85
38
|
|
|
86
|
-
|
|
87
|
-
2. Groups changes with OpenAI
|
|
88
|
-
3. Creates Conventional Commits format messages for each group
|
|
89
|
-
4. Shows commit plan and asks for confirmation
|
|
90
|
-
5. Creates each group as a separate commit after approval
|
|
91
|
-
6. **Does not push** - you need to push manually
|
|
92
|
-
|
|
93
|
-
### Example Output
|
|
39
|
+
### Example
|
|
94
40
|
|
|
95
41
|
```
|
|
96
|
-
🤖 Git
|
|
42
|
+
🤖 Git AI
|
|
97
43
|
|
|
98
|
-
✓
|
|
44
|
+
✓ Found 5 file(s), 8 change(s)
|
|
99
45
|
|
|
100
|
-
|
|
46
|
+
Changes:
|
|
47
|
+
+ src/new-feature.ts
|
|
48
|
+
~ src/auth.ts
|
|
49
|
+
~ src/config.ts
|
|
50
|
+
- src/old-file.ts
|
|
101
51
|
|
|
102
|
-
✓ 3
|
|
52
|
+
✓ Created 3 commit group(s)
|
|
103
53
|
|
|
104
54
|
📋 Commit Plan:
|
|
105
55
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Group 2: UI component updates
|
|
112
|
-
Files: Button.tsx, Input.tsx, styles.css
|
|
113
|
-
Commit: style(ui): update design system colors
|
|
114
|
-
Updated design system colors. Improved dark mode support.
|
|
115
|
-
|
|
116
|
-
Group 3: API endpoint refactoring
|
|
117
|
-
Files: api/users.ts, api/types.ts
|
|
118
|
-
Commit: refactor(api): simplify user endpoint logic
|
|
119
|
-
Simplified user endpoint logic. Improved error handling.
|
|
120
|
-
|
|
121
|
-
Do you approve this commit plan? (Y/n)
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Conventional Commits Format
|
|
125
|
-
|
|
126
|
-
The tool uses the [Conventional Commits](https://www.conventionalcommits.org/) standard:
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
<type>(<scope>): <subject>
|
|
130
|
-
|
|
131
|
-
<body>
|
|
132
|
-
|
|
133
|
-
<footer>
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Commit Types
|
|
137
|
-
|
|
138
|
-
- `feat`: New feature
|
|
139
|
-
- `fix`: Bug fix
|
|
140
|
-
- `refactor`: Code refactoring
|
|
141
|
-
- `style`: Formatting, styling changes
|
|
142
|
-
- `docs`: Documentation
|
|
143
|
-
- `test`: Tests
|
|
144
|
-
- `chore`: Maintenance tasks
|
|
145
|
-
|
|
146
|
-
## Git User Management
|
|
147
|
-
|
|
148
|
-
The tool allows you to manage multiple git user profiles:
|
|
149
|
-
|
|
150
|
-
- Automatic detection from global and local git configs
|
|
151
|
-
- List active git users
|
|
152
|
-
- Default user selection (during setup)
|
|
153
|
-
- Manual profile addition
|
|
154
|
-
- Different user selection during commit with `--user` or `-u` flag
|
|
155
|
-
|
|
156
|
-
### User Management During Setup
|
|
157
|
-
|
|
158
|
-
When running the setup command:
|
|
159
|
-
|
|
160
|
-
1. **Active git user profiles are listed:**
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
📋 Active Git User Profiles:
|
|
164
|
-
1. John Doe <john@example.com> (Global) [shortcut: g]
|
|
165
|
-
2. Jane Smith <jane@example.com> (Local) [shortcut: t]
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
2. **Shortcuts can be added for each user:**
|
|
169
|
-
|
|
170
|
-
- "Would you like to add a shortcut?" question is asked for each user
|
|
171
|
-
- Shortcut key is entered (can be single or multi-character, e.g., `g`, `my`, `work`, `personal`)
|
|
172
|
-
- Shortcuts can be used during commit
|
|
173
|
-
|
|
174
|
-
3. **Default user is selected:**
|
|
175
|
-
|
|
176
|
-
- Automatically selected if there's only one user
|
|
177
|
-
- Selection is made if there are multiple users
|
|
178
|
-
|
|
179
|
-
4. **Optionally, more profiles can be added**
|
|
180
|
-
|
|
181
|
-
5. **Default user can be updated after adding new profiles**
|
|
182
|
-
|
|
183
|
-
### User Selection During Commit
|
|
184
|
-
|
|
185
|
-
**Default usage:**
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
git-ai commit
|
|
189
|
-
# Uses default user from config
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**With different user:**
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
# Using shortcut (easiest - recommended, single or multi-character)
|
|
196
|
-
git-ai commit --user my
|
|
197
|
-
git-ai commit --user work
|
|
198
|
-
git-ai commit -u personal
|
|
56
|
+
1. Add authentication feature
|
|
57
|
+
src/auth.ts
|
|
58
|
+
src/new-feature.ts
|
|
59
|
+
→ feat(auth): add login functionality
|
|
199
60
|
|
|
200
|
-
|
|
201
|
-
|
|
61
|
+
2. Update configuration
|
|
62
|
+
src/config.ts
|
|
63
|
+
→ refactor(config): simplify config handling
|
|
202
64
|
|
|
203
|
-
|
|
204
|
-
|
|
65
|
+
3. Remove deprecated code
|
|
66
|
+
src/old-file.ts
|
|
67
|
+
→ chore: remove unused files
|
|
205
68
|
|
|
206
|
-
|
|
207
|
-
git-ai commit --user local-jane@example.com
|
|
208
|
-
```
|
|
69
|
+
? Proceed with commits? Yes
|
|
209
70
|
|
|
210
|
-
|
|
71
|
+
✓ 3 commit(s) created
|
|
211
72
|
|
|
212
|
-
|
|
213
|
-
git-ai list
|
|
214
|
-
# or
|
|
215
|
-
git-ai users
|
|
73
|
+
⚠ Don't forget to push: git push
|
|
216
74
|
```
|
|
217
75
|
|
|
218
76
|
## Commands
|
|
219
77
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
git-ai
|
|
226
|
-
# or
|
|
227
|
-
npx @mehmetsagir/git-ai setup
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Initial setup - OpenAI API key and git user configuration.
|
|
231
|
-
|
|
232
|
-
### Commit
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
git-ai commit [--user <user>]
|
|
236
|
-
# or
|
|
237
|
-
npx @mehmetsagir/git-ai commit [--user <user>]
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
Analyze git diffs and create commits. Use `--user` or `-u` to specify a different git user.
|
|
241
|
-
|
|
242
|
-
### Add User
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
git-ai add
|
|
246
|
-
# or
|
|
247
|
-
git-ai add-user
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
Add a new git user profile.
|
|
251
|
-
|
|
252
|
-
### List Users
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
git-ai list
|
|
256
|
-
# or
|
|
257
|
-
git-ai users
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
List all configured git user profiles.
|
|
261
|
-
|
|
262
|
-
### Remove User
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
git-ai remove
|
|
266
|
-
# or
|
|
267
|
-
git-ai delete
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Remove a git user profile interactively.
|
|
271
|
-
|
|
272
|
-
### Reset
|
|
273
|
-
|
|
274
|
-
```bash
|
|
275
|
-
git-ai reset
|
|
276
|
-
```
|
|
78
|
+
| Command | Description |
|
|
79
|
+
|---------|-------------|
|
|
80
|
+
| `git-ai setup` | Configure OpenAI API key |
|
|
81
|
+
| `git-ai commit` | Analyze and create commits |
|
|
82
|
+
| `git-ai stash` | View git stashes in browser |
|
|
83
|
+
| `git-ai reset` | Reset configuration |
|
|
277
84
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
### Update
|
|
85
|
+
### Stash Viewer
|
|
281
86
|
|
|
282
87
|
```bash
|
|
283
|
-
git-ai
|
|
88
|
+
git-ai stash
|
|
284
89
|
```
|
|
285
90
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
1. **Run setup:**
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
# If installed globally
|
|
294
|
-
git-ai setup
|
|
295
|
-
|
|
296
|
-
# Or with npx
|
|
297
|
-
npx @mehmetsagir/git-ai setup
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
- 3 user profiles detected
|
|
301
|
-
- Shortcuts added for each user:
|
|
302
|
-
- `work@company.com` → shortcut: `w`
|
|
303
|
-
- `personal@gmail.com` → shortcut: `p`
|
|
304
|
-
- `other@example.com` → shortcut: `o`
|
|
305
|
-
- `work@company.com` selected as default
|
|
306
|
-
|
|
307
|
-
2. **For work commit (default user):**
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
git-ai commit
|
|
311
|
-
# Uses work@company.com
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
3. **For personal project (using shortcut):**
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
git-ai commit --user p
|
|
318
|
-
# or
|
|
319
|
-
git-ai commit -u p
|
|
320
|
-
# Uses personal@gmail.com
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
4. **For other project (using shortcut):**
|
|
324
|
-
```bash
|
|
325
|
-
git-ai commit --user o
|
|
326
|
-
# Uses other@example.com
|
|
327
|
-
```
|
|
91
|
+
Opens a browser with a visual interface to view all your git stashes:
|
|
92
|
+
- See all stashes with branch, message, and date
|
|
93
|
+
- Click to expand and view the full diff
|
|
94
|
+
- Syntax highlighting for code changes
|
|
328
95
|
|
|
329
96
|
## Configuration
|
|
330
97
|
|
|
331
|
-
|
|
98
|
+
Config file: `~/.git-ai/config.json`
|
|
332
99
|
|
|
333
100
|
```json
|
|
334
101
|
{
|
|
335
|
-
"openaiKey": "sk-..."
|
|
336
|
-
"gitUsers": [
|
|
337
|
-
{
|
|
338
|
-
"id": "global-user@example.com",
|
|
339
|
-
"name": "John Doe",
|
|
340
|
-
"email": "user@example.com",
|
|
341
|
-
"scope": "global",
|
|
342
|
-
"label": "John Doe <user@example.com> (Global)",
|
|
343
|
-
"shortcut": "g"
|
|
344
|
-
}
|
|
345
|
-
],
|
|
346
|
-
"defaultGitUser": "global-user@example.com"
|
|
102
|
+
"openaiKey": "sk-..."
|
|
347
103
|
}
|
|
348
104
|
```
|
|
349
105
|
|
|
@@ -353,44 +109,60 @@ Configuration file: `~/.git-ai/config.json`
|
|
|
353
109
|
- OpenAI API key
|
|
354
110
|
- Git repository
|
|
355
111
|
|
|
356
|
-
##
|
|
112
|
+
## Changelog
|
|
357
113
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
- Git user information is stored locally
|
|
114
|
+
### v0.0.18
|
|
115
|
+
**Stash Viewer Improvements**
|
|
361
116
|
|
|
362
|
-
|
|
117
|
+
- Redesigned UI with navigation pattern (click stash to view details, back button to return)
|
|
118
|
+
- VS Code-style split diff view (Original | Modified)
|
|
119
|
+
- Added Apply and Delete stash actions
|
|
120
|
+
- Toast notifications for action feedback
|
|
121
|
+
- Added git-ai branding footer with GitHub link
|
|
363
122
|
|
|
364
|
-
###
|
|
123
|
+
### v0.0.16
|
|
124
|
+
**Stash Viewer**
|
|
365
125
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
126
|
+
- New `git-ai stash` command
|
|
127
|
+
- Browse stashes in a web UI
|
|
128
|
+
- View diffs with syntax highlighting
|
|
129
|
+
- Click to expand/collapse each stash
|
|
369
130
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
```
|
|
131
|
+
### v0.0.15
|
|
132
|
+
**Code Cleanup**
|
|
373
133
|
|
|
374
|
-
|
|
134
|
+
- Removed 7 unused functions from git.ts (54% smaller)
|
|
135
|
+
- Removed unused `createPatch` from hunk-parser.ts
|
|
136
|
+
- Cleaned up package.json metadata
|
|
137
|
+
- Added `bugs` and `homepage` fields
|
|
375
138
|
|
|
376
|
-
|
|
139
|
+
### v0.0.14
|
|
140
|
+
**Major Refactor - Stability Release**
|
|
377
141
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
142
|
+
**Added:**
|
|
143
|
+
- Catch-all group for files missed by AI grouping
|
|
144
|
+
- Support for untracked (new) files in commit analysis
|
|
145
|
+
- Robust diff parser with file path validation
|
|
381
146
|
|
|
382
|
-
|
|
147
|
+
**Changed:**
|
|
148
|
+
- Simplified to file-based grouping (more reliable than hunk-based)
|
|
149
|
+
- Improved error handling throughout
|
|
383
150
|
|
|
384
|
-
|
|
151
|
+
**Removed:**
|
|
152
|
+
- User management features (add, list, remove users)
|
|
153
|
+
- Editor-based commit message editing
|
|
154
|
+
- Update notifier
|
|
155
|
+
- Hunk-level commit splitting (caused file corruption issues)
|
|
156
|
+
- Summary command
|
|
385
157
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
158
|
+
**Fixed:**
|
|
159
|
+
- Parser no longer misinterprets diff content as file names
|
|
160
|
+
- All changed files now included in commits (no orphaned files)
|
|
161
|
+
- No more "corrupt patch" errors
|
|
162
|
+
|
|
163
|
+
### v0.0.13 and earlier
|
|
164
|
+
- Initial releases with experimental hunk-based commit splitting
|
|
389
165
|
|
|
390
166
|
## License
|
|
391
167
|
|
|
392
168
|
MIT
|
|
393
|
-
|
|
394
|
-
## Contributing
|
|
395
|
-
|
|
396
|
-
Contributions are welcome! Please open an issue or submit a pull request.
|
package/dist/commit.d.ts
CHANGED
package/dist/commit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAUA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAmN/C"}
|