@mehmetsagir/git-ai 0.0.18 → 0.0.19
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 +137 -71
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# git-ai
|
|
2
2
|
|
|
3
|
-
AI-powered git commit tool
|
|
3
|
+
AI-powered git commit tool that analyzes your changes, groups them logically, and creates meaningful commits following the Conventional Commits standard.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Smart Grouping
|
|
8
|
-
- **Conventional Commits
|
|
9
|
-
- **
|
|
10
|
-
- **Safe
|
|
11
|
-
- **Stash Viewer**: Browse git stashes in a web UI with syntax highlighting
|
|
7
|
+
- **Smart Commit Grouping** - AI analyzes your changes and groups related files together by feature or purpose
|
|
8
|
+
- **Conventional Commits** - Automatically generates commit messages in standard format (`feat`, `fix`, `refactor`, `chore`, etc.)
|
|
9
|
+
- **Stash Viewer** - Browse and manage git stashes in a beautiful web UI with diff viewer
|
|
10
|
+
- **Safe Workflow** - Always shows a commit plan for your approval before making any changes
|
|
12
11
|
|
|
13
12
|
## Installation
|
|
14
13
|
|
|
@@ -18,26 +17,33 @@ npm install -g @mehmetsagir/git-ai
|
|
|
18
17
|
|
|
19
18
|
## Setup
|
|
20
19
|
|
|
20
|
+
Before using git-ai, you need to configure your OpenAI API key:
|
|
21
|
+
|
|
21
22
|
```bash
|
|
22
23
|
git-ai setup
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
You'll be prompted to enter your OpenAI API key. Get one from [OpenAI Platform](https://platform.openai.com/api-keys).
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
### `git-ai commit`
|
|
31
|
+
|
|
32
|
+
Analyze all changes in your repository and create intelligent commits.
|
|
28
33
|
|
|
29
34
|
```bash
|
|
30
35
|
git-ai commit
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
1.
|
|
35
|
-
2.
|
|
36
|
-
3.
|
|
37
|
-
4.
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
**What it does:**
|
|
39
|
+
1. Scans all changes (staged, unstaged, and untracked files)
|
|
40
|
+
2. Sends diff to AI for analysis
|
|
41
|
+
3. Groups related files together
|
|
42
|
+
4. Generates commit messages for each group
|
|
43
|
+
5. Shows you the commit plan for approval
|
|
44
|
+
6. Creates commits after your confirmation
|
|
40
45
|
|
|
46
|
+
**Example output:**
|
|
41
47
|
```
|
|
42
48
|
🤖 Git AI
|
|
43
49
|
|
|
@@ -73,29 +79,41 @@ Changes:
|
|
|
73
79
|
⚠ Don't forget to push: git push
|
|
74
80
|
```
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
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 |
|
|
82
|
+
### `git-ai stash`
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
Open a web-based UI to browse and manage your git stashes.
|
|
86
85
|
|
|
87
86
|
```bash
|
|
88
87
|
git-ai stash
|
|
89
88
|
```
|
|
90
89
|
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
- Click to
|
|
90
|
+
**Features:**
|
|
91
|
+
- View all stashes in a clean list
|
|
92
|
+
- Click to see changed files and full diff
|
|
93
|
+
- VS Code-style split diff view (Original | Modified)
|
|
94
|
+
- Apply stash to your working directory
|
|
95
|
+
- Delete stashes you no longer need
|
|
94
96
|
- Syntax highlighting for code changes
|
|
95
97
|
|
|
98
|
+
### `git-ai setup`
|
|
99
|
+
|
|
100
|
+
Configure or update your OpenAI API key.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git-ai setup
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### `git-ai reset`
|
|
107
|
+
|
|
108
|
+
Reset all configuration (removes stored API key).
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
git-ai reset
|
|
112
|
+
```
|
|
113
|
+
|
|
96
114
|
## Configuration
|
|
97
115
|
|
|
98
|
-
|
|
116
|
+
Configuration is stored in `~/.git-ai/config.json`:
|
|
99
117
|
|
|
100
118
|
```json
|
|
101
119
|
{
|
|
@@ -106,63 +124,111 @@ Config file: `~/.git-ai/config.json`
|
|
|
106
124
|
## Requirements
|
|
107
125
|
|
|
108
126
|
- Node.js >= 14.0.0
|
|
109
|
-
- OpenAI API key
|
|
110
127
|
- Git repository
|
|
128
|
+
- OpenAI API key
|
|
111
129
|
|
|
112
|
-
##
|
|
130
|
+
## Contributing
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
**Stash Viewer Improvements**
|
|
132
|
+
Contributions are welcome! Here's how you can help:
|
|
116
133
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
### Development Setup
|
|
135
|
+
|
|
136
|
+
1. **Clone the repository**
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/mehmetsagir/git-ai.git
|
|
139
|
+
cd git-ai
|
|
140
|
+
```
|
|
122
141
|
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
2. **Install dependencies**
|
|
143
|
+
```bash
|
|
144
|
+
npm install
|
|
145
|
+
```
|
|
125
146
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
147
|
+
3. **Build the project**
|
|
148
|
+
```bash
|
|
149
|
+
npm run build
|
|
150
|
+
```
|
|
130
151
|
|
|
131
|
-
|
|
132
|
-
|
|
152
|
+
4. **Test locally**
|
|
153
|
+
```bash
|
|
154
|
+
# Run directly
|
|
155
|
+
node bin/git-ai [command]
|
|
133
156
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
|
|
157
|
+
# Or link globally
|
|
158
|
+
npm link
|
|
159
|
+
git-ai [command]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Project Structure
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
src/
|
|
166
|
+
├── index.ts # CLI entry point and command routing
|
|
167
|
+
├── git.ts # Git operations (using simple-git)
|
|
168
|
+
├── openai.ts # OpenAI API integration
|
|
169
|
+
├── commit.ts # Commit workflow logic
|
|
170
|
+
├── stash.ts # Stash viewer web UI
|
|
171
|
+
├── config.ts # Configuration management
|
|
172
|
+
├── setup.ts # Setup wizard
|
|
173
|
+
├── reset.ts # Reset configuration
|
|
174
|
+
├── prompts.ts # AI prompts for commit analysis
|
|
175
|
+
├── types.ts # TypeScript type definitions
|
|
176
|
+
└── utils/
|
|
177
|
+
├── errors.ts # Error handling utilities
|
|
178
|
+
└── hunk-parser.ts # Diff parsing utilities
|
|
179
|
+
```
|
|
138
180
|
|
|
139
|
-
###
|
|
140
|
-
**Major Refactor - Stability Release**
|
|
181
|
+
### Making Changes
|
|
141
182
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
183
|
+
1. Create a new branch for your feature
|
|
184
|
+
```bash
|
|
185
|
+
git checkout -b feature/your-feature-name
|
|
186
|
+
```
|
|
146
187
|
|
|
147
|
-
|
|
148
|
-
- Simplified to file-based grouping (more reliable than hunk-based)
|
|
149
|
-
- Improved error handling throughout
|
|
188
|
+
2. Make your changes and test them locally
|
|
150
189
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- Hunk-level commit splitting (caused file corruption issues)
|
|
156
|
-
- Summary command
|
|
190
|
+
3. Build and verify there are no TypeScript errors
|
|
191
|
+
```bash
|
|
192
|
+
npm run build
|
|
193
|
+
```
|
|
157
194
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
195
|
+
4. Commit your changes using conventional commits format
|
|
196
|
+
```bash
|
|
197
|
+
git commit -m "feat: add new feature"
|
|
198
|
+
```
|
|
162
199
|
|
|
163
|
-
|
|
164
|
-
|
|
200
|
+
5. Push and create a pull request
|
|
201
|
+
```bash
|
|
202
|
+
git push origin feature/your-feature-name
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Commit Message Guidelines
|
|
206
|
+
|
|
207
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
208
|
+
|
|
209
|
+
- `feat:` - New features
|
|
210
|
+
- `fix:` - Bug fixes
|
|
211
|
+
- `refactor:` - Code changes that neither fix bugs nor add features
|
|
212
|
+
- `chore:` - Maintenance tasks
|
|
213
|
+
- `docs:` - Documentation changes
|
|
214
|
+
- `style:` - Code style changes (formatting, etc.)
|
|
215
|
+
- `test:` - Adding or updating tests
|
|
216
|
+
|
|
217
|
+
### Reporting Issues
|
|
218
|
+
|
|
219
|
+
Found a bug or have a suggestion? [Open an issue](https://github.com/mehmetsagir/git-ai/issues) with:
|
|
220
|
+
|
|
221
|
+
- Clear description of the problem or suggestion
|
|
222
|
+
- Steps to reproduce (for bugs)
|
|
223
|
+
- Expected vs actual behavior
|
|
224
|
+
- Your environment (Node.js version, OS, etc.)
|
|
165
225
|
|
|
166
226
|
## License
|
|
167
227
|
|
|
168
228
|
MIT
|
|
229
|
+
|
|
230
|
+
## Links
|
|
231
|
+
|
|
232
|
+
- [GitHub Repository](https://github.com/mehmetsagir/git-ai)
|
|
233
|
+
- [npm Package](https://www.npmjs.com/package/@mehmetsagir/git-ai)
|
|
234
|
+
- [Report Issues](https://github.com/mehmetsagir/git-ai/issues)
|