gitdude 1.0.0__tar.gz
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.
- gitdude-1.0.0/.env.example +17 -0
- gitdude-1.0.0/.gitignore +1 -0
- gitdude-1.0.0/PKG-INFO +305 -0
- gitdude-1.0.0/README.md +266 -0
- gitdude-1.0.0/gitwise/__init__.py +5 -0
- gitdude-1.0.0/gitwise/ai.py +148 -0
- gitdude-1.0.0/gitwise/config.py +106 -0
- gitdude-1.0.0/gitwise/git_ops.py +235 -0
- gitdude-1.0.0/gitwise/main.py +826 -0
- gitdude-1.0.0/gitwise/utils.py +150 -0
- gitdude-1.0.0/pyproject.toml +70 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# GitWise — AI Provider API Keys
|
|
2
|
+
# Copy this file to .env and fill in your keys.
|
|
3
|
+
# NOTE: GitWise does NOT read .env files directly.
|
|
4
|
+
# Keys are stored securely in ~/.gitwise/config.json via `gitwise config`.
|
|
5
|
+
# These are only here as a reference for the key names.
|
|
6
|
+
|
|
7
|
+
# Google Gemini (default — free at https://aistudio.google.com/app/apikey)
|
|
8
|
+
GEMINI_API_KEY=your-gemini-api-key-here
|
|
9
|
+
|
|
10
|
+
# Groq (free tier — fastest inference, https://console.groq.com/keys)
|
|
11
|
+
GROQ_API_KEY=your-groq-api-key-here
|
|
12
|
+
|
|
13
|
+
# OpenAI (optional — https://platform.openai.com/api-keys)
|
|
14
|
+
OPENAI_API_KEY=your-openai-api-key-here
|
|
15
|
+
|
|
16
|
+
# Ollama: no API key needed — fully local
|
|
17
|
+
# Make sure Ollama is running: https://ollama.ai
|
gitdude-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist
|
gitdude-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitdude
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI-powered Git workflow assistant — commit, review, recover, and more with a single command
|
|
5
|
+
Project-URL: Homepage, https://github.com/utkarshgupta188/gitdude
|
|
6
|
+
Project-URL: Repository, https://github.com/utkarshgupta188/gitdude
|
|
7
|
+
Project-URL: Documentation, https://github.com/utkarshgupta188/gitdude#readme
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/utkarshgupta188/gitdude/issues
|
|
9
|
+
Author: GitDude Contributors
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: ai,cli,developer-tools,gemini,git,groq,ollama,openai
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: gitpython>=3.1.40
|
|
26
|
+
Requires-Dist: google-generativeai>=0.7.0
|
|
27
|
+
Requires-Dist: groq>=0.9.0
|
|
28
|
+
Requires-Dist: ollama>=0.2.0
|
|
29
|
+
Requires-Dist: openai>=1.30.0
|
|
30
|
+
Requires-Dist: pyperclip>=1.8.2
|
|
31
|
+
Requires-Dist: rich>=13.7.0
|
|
32
|
+
Requires-Dist: typer[all]>=0.12.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: mypy>=1.10.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# GitDude 🧠
|
|
41
|
+
|
|
42
|
+
[](https://pypi.org/project/gitwise/)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
[](https://opensource.org/licenses/MIT)
|
|
45
|
+
[](https://pypi.org/project/gitwise/)
|
|
46
|
+
|
|
47
|
+
**GitDude is an AI-powered Git workflow assistant that turns plain English into git actions — commit, review, recover, and understand your repo from the terminal.**
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## ✨ Features
|
|
52
|
+
|
|
53
|
+
- 🤖 **Multi-provider AI** — Gemini (default, free), Groq (fastest), Ollama (100% local), OpenAI
|
|
54
|
+
- 💬 **Natural language commands** — `gitwise do "stash, switch to main, pull"`
|
|
55
|
+
- 🔍 **AI code review** — bugs, security issues, quality flags before you push
|
|
56
|
+
- 🚑 **Emergency recovery** — `gitwise whoops` diagnoses and fixes git disasters
|
|
57
|
+
- 📋 **PR generation** — full GitHub PR description, auto-copied to clipboard
|
|
58
|
+
- 🎨 **Beautiful Rich UI** — tables, panels, spinners, color-coded output
|
|
59
|
+
- 🔐 **Secure config** — keys stored in `~/.gitdude/config.json`, never in `.env`
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🚀 Quick Start
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 1. Install
|
|
67
|
+
pip install gitdude
|
|
68
|
+
|
|
69
|
+
# 2. Configure (takes 60 seconds)
|
|
70
|
+
gitwise config
|
|
71
|
+
|
|
72
|
+
# 3. Generate an AI commit message and push
|
|
73
|
+
gitwise push
|
|
74
|
+
|
|
75
|
+
# 4. Review your code before merging
|
|
76
|
+
gitwise review
|
|
77
|
+
|
|
78
|
+
# 5. Something went wrong? Ask for help
|
|
79
|
+
gitwise whoops
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📦 Installation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install gitdude
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Python 3.10+ required.**
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🔑 Provider Setup
|
|
95
|
+
|
|
96
|
+
### Google Gemini (Default — Free)
|
|
97
|
+
|
|
98
|
+
1. Get an API key from [Google AI Studio](https://aistudio.google.com/app/apikey)
|
|
99
|
+
2. Run `gitwise config` → choose `gemini` → paste key
|
|
100
|
+
|
|
101
|
+
### Groq (Fastest Free Tier)
|
|
102
|
+
|
|
103
|
+
1. Get a key at [console.groq.com/keys](https://console.groq.com/keys)
|
|
104
|
+
2. Run `gitwise config` → choose `groq` → paste key
|
|
105
|
+
|
|
106
|
+
### Ollama (100% Local/Offline)
|
|
107
|
+
|
|
108
|
+
1. Install Ollama: [ollama.ai](https://ollama.ai)
|
|
109
|
+
2. Pull a model: `ollama pull llama3`
|
|
110
|
+
3. Run `gitwise config` → choose `ollama` (no key needed)
|
|
111
|
+
|
|
112
|
+
### OpenAI
|
|
113
|
+
|
|
114
|
+
1. Get a key at [platform.openai.com](https://platform.openai.com/api-keys)
|
|
115
|
+
2. Run `gitwise config` → choose `openai` → paste key
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 📖 Command Reference
|
|
120
|
+
|
|
121
|
+
### `gitwise push`
|
|
122
|
+
|
|
123
|
+
AI-generates a commit message for your changes, lets you confirm/edit, then commits and pushes.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
gitwise push # Stage all → AI commit → push
|
|
127
|
+
gitwise push --no-confirm # Skip confirmation
|
|
128
|
+
gitwise push --dry-run # Preview only, don't execute
|
|
129
|
+
gitwise push --style freeform # Use freeform (not conventional) commit style
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Commit types (conventional):** `feat`, `fix`, `chore`, `docs`, `refactor`, `style`, `test`, `perf`, `ci`
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### `gitwise sync`
|
|
137
|
+
|
|
138
|
+
Fetch + rebase. If there are merge conflicts, AI explains what's conflicting and gives exact resolution steps.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
gitwise sync
|
|
142
|
+
gitwise sync --dry-run
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `gitwise back`
|
|
148
|
+
|
|
149
|
+
Shows last 30 commits in a table. Pick one to go back to, choose a mode.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
gitwise back
|
|
153
|
+
gitwise back --dry-run
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Modes:** `soft` (keep changes staged), `hard` (discard changes), `checkout` (detached HEAD), `branch` (new branch from that commit)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### `gitwise undo "<description>"`
|
|
161
|
+
|
|
162
|
+
Describe what went wrong — AI reads your log and reflog to determine the safest recovery.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
gitwise undo "I accidentally committed my .env file"
|
|
166
|
+
gitwise undo "I deleted the wrong branch"
|
|
167
|
+
gitwise undo "I made a mess of the last 3 commits" --dry-run
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### `gitwise do "<natural language>"`
|
|
173
|
+
|
|
174
|
+
Convert plain English into a sequence of git commands, preview, then execute.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
gitwise do "stash my changes, switch to main, pull latest"
|
|
178
|
+
gitwise do "create a new branch called feature/auth and push it"
|
|
179
|
+
gitwise do "squash my last 3 commits" --dry-run
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
If any command fails, AI reads the error and suggests a fix.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### `gitwise review`
|
|
187
|
+
|
|
188
|
+
Diffs your current branch vs main/master, then AI reviews for bugs, security issues, and quality.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
gitwise review
|
|
192
|
+
gitwise review --base develop # Compare against a different branch
|
|
193
|
+
gitwise review --dry-run # Show diff without AI review
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Review sections:** Summary · ⚠️ Potential Bugs · 🔒 Security Issues · 📏 Code Quality · 🔍 Things to Check · ✅ Overall Assessment
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### `gitwise pr`
|
|
201
|
+
|
|
202
|
+
Generates a complete PR title + description + bullet list + testing notes. Auto-copies to clipboard.
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
gitwise pr
|
|
206
|
+
gitwise pr --base develop # Compare against develop
|
|
207
|
+
gitwise pr --no-copy # Don't copy to clipboard
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### `gitwise explain`
|
|
213
|
+
|
|
214
|
+
Reads your last 5 reflog entries and explains in plain English what happened.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
gitwise explain
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### `gitwise whoops`
|
|
223
|
+
|
|
224
|
+
Emergency recovery. Feeds git status + log + reflog to AI. Diagnoses what went wrong and gives step-by-step recovery.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
gitwise whoops
|
|
228
|
+
gitwise whoops --dry-run # Diagnose only, don't execute
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### `gitwise config`
|
|
234
|
+
|
|
235
|
+
Interactive configuration wizard.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
gitwise config # Run setup
|
|
239
|
+
gitwise config --show # Print current config (keys masked)
|
|
240
|
+
gitwise config --reset # Wipe config and redo setup
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Stored settings:**
|
|
244
|
+
- AI provider (`gemini` / `groq` / `ollama` / `openai`)
|
|
245
|
+
- API key per provider
|
|
246
|
+
- Model name per provider
|
|
247
|
+
- Default branch (`main` or `master`)
|
|
248
|
+
- Commit style (`conventional` or `freeform`)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 🏗️ Architecture
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
gitwise/
|
|
256
|
+
├── main.py # Typer app — all command definitions
|
|
257
|
+
├── ai.py # Unified AI provider wrapper (ask_ai)
|
|
258
|
+
├── git_ops.py # GitPython operations (diff, log, push, reset…)
|
|
259
|
+
├── config.py # Config at ~/.gitdude/config.json
|
|
260
|
+
└── utils.py # Rich panels, tables, prompts, helpers
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**AI Providers (`ai.py`):**
|
|
264
|
+
|
|
265
|
+
| Provider | SDK | Default Model | Speed | Cost |
|
|
266
|
+
|---|---|---|---|---|
|
|
267
|
+
| `gemini` | `google-generativeai` | `gemini-2.0-flash` | Fast | Free tier |
|
|
268
|
+
| `groq` | `groq` | `llama-3.3-70b-versatile` | Fastest | Free tier |
|
|
269
|
+
| `ollama` | `ollama` | `llama3` | Local | Free (local) |
|
|
270
|
+
| `openai` | `openai` | `gpt-4o-mini` | Fast | Pay per use |
|
|
271
|
+
|
|
272
|
+
All providers go through a single interface: `ask_ai(prompt) -> str` with spinner feedback and unified error handling.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 🛡️ Safety Features
|
|
277
|
+
|
|
278
|
+
- ✅ **All destructive operations** (hard reset, force push, etc.) require explicit confirmation
|
|
279
|
+
- ✅ **`--dry-run` flag** available on all mutating commands
|
|
280
|
+
- ✅ **Color-coded risk levels** — green (safe), yellow (caution), red (destructive)
|
|
281
|
+
- ✅ **No tracebacks** — all exceptions caught and shown as friendly Rich error panels
|
|
282
|
+
- ✅ **API keys** stored privately in `~/.gitdude/config.json`, never in project files
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 🤝 Contributing
|
|
287
|
+
|
|
288
|
+
1. Fork the repo
|
|
289
|
+
2. Create a feature branch: `git checkout -b feat/amazing-feature`
|
|
290
|
+
3. Make your changes
|
|
291
|
+
4. Run linting: `ruff check .`
|
|
292
|
+
5. Open a PR — or just use `gitwise pr` to generate your PR description! 😄
|
|
293
|
+
|
|
294
|
+
**Dev setup:**
|
|
295
|
+
```bash
|
|
296
|
+
git clone https://github.com/gitwise/gitwise
|
|
297
|
+
cd gitwise
|
|
298
|
+
pip install -e ".[dev]"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## 📄 License
|
|
304
|
+
|
|
305
|
+
MIT © GitWise Contributors
|
gitdude-1.0.0/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# GitDude 🧠
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/gitwise/)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://pypi.org/project/gitwise/)
|
|
7
|
+
|
|
8
|
+
**GitDude is an AI-powered Git workflow assistant that turns plain English into git actions — commit, review, recover, and understand your repo from the terminal.**
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- 🤖 **Multi-provider AI** — Gemini (default, free), Groq (fastest), Ollama (100% local), OpenAI
|
|
15
|
+
- 💬 **Natural language commands** — `gitwise do "stash, switch to main, pull"`
|
|
16
|
+
- 🔍 **AI code review** — bugs, security issues, quality flags before you push
|
|
17
|
+
- 🚑 **Emergency recovery** — `gitwise whoops` diagnoses and fixes git disasters
|
|
18
|
+
- 📋 **PR generation** — full GitHub PR description, auto-copied to clipboard
|
|
19
|
+
- 🎨 **Beautiful Rich UI** — tables, panels, spinners, color-coded output
|
|
20
|
+
- 🔐 **Secure config** — keys stored in `~/.gitdude/config.json`, never in `.env`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🚀 Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# 1. Install
|
|
28
|
+
pip install gitdude
|
|
29
|
+
|
|
30
|
+
# 2. Configure (takes 60 seconds)
|
|
31
|
+
gitwise config
|
|
32
|
+
|
|
33
|
+
# 3. Generate an AI commit message and push
|
|
34
|
+
gitwise push
|
|
35
|
+
|
|
36
|
+
# 4. Review your code before merging
|
|
37
|
+
gitwise review
|
|
38
|
+
|
|
39
|
+
# 5. Something went wrong? Ask for help
|
|
40
|
+
gitwise whoops
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📦 Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install gitdude
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Python 3.10+ required.**
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 🔑 Provider Setup
|
|
56
|
+
|
|
57
|
+
### Google Gemini (Default — Free)
|
|
58
|
+
|
|
59
|
+
1. Get an API key from [Google AI Studio](https://aistudio.google.com/app/apikey)
|
|
60
|
+
2. Run `gitwise config` → choose `gemini` → paste key
|
|
61
|
+
|
|
62
|
+
### Groq (Fastest Free Tier)
|
|
63
|
+
|
|
64
|
+
1. Get a key at [console.groq.com/keys](https://console.groq.com/keys)
|
|
65
|
+
2. Run `gitwise config` → choose `groq` → paste key
|
|
66
|
+
|
|
67
|
+
### Ollama (100% Local/Offline)
|
|
68
|
+
|
|
69
|
+
1. Install Ollama: [ollama.ai](https://ollama.ai)
|
|
70
|
+
2. Pull a model: `ollama pull llama3`
|
|
71
|
+
3. Run `gitwise config` → choose `ollama` (no key needed)
|
|
72
|
+
|
|
73
|
+
### OpenAI
|
|
74
|
+
|
|
75
|
+
1. Get a key at [platform.openai.com](https://platform.openai.com/api-keys)
|
|
76
|
+
2. Run `gitwise config` → choose `openai` → paste key
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 📖 Command Reference
|
|
81
|
+
|
|
82
|
+
### `gitwise push`
|
|
83
|
+
|
|
84
|
+
AI-generates a commit message for your changes, lets you confirm/edit, then commits and pushes.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
gitwise push # Stage all → AI commit → push
|
|
88
|
+
gitwise push --no-confirm # Skip confirmation
|
|
89
|
+
gitwise push --dry-run # Preview only, don't execute
|
|
90
|
+
gitwise push --style freeform # Use freeform (not conventional) commit style
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Commit types (conventional):** `feat`, `fix`, `chore`, `docs`, `refactor`, `style`, `test`, `perf`, `ci`
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### `gitwise sync`
|
|
98
|
+
|
|
99
|
+
Fetch + rebase. If there are merge conflicts, AI explains what's conflicting and gives exact resolution steps.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
gitwise sync
|
|
103
|
+
gitwise sync --dry-run
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### `gitwise back`
|
|
109
|
+
|
|
110
|
+
Shows last 30 commits in a table. Pick one to go back to, choose a mode.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
gitwise back
|
|
114
|
+
gitwise back --dry-run
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Modes:** `soft` (keep changes staged), `hard` (discard changes), `checkout` (detached HEAD), `branch` (new branch from that commit)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### `gitwise undo "<description>"`
|
|
122
|
+
|
|
123
|
+
Describe what went wrong — AI reads your log and reflog to determine the safest recovery.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
gitwise undo "I accidentally committed my .env file"
|
|
127
|
+
gitwise undo "I deleted the wrong branch"
|
|
128
|
+
gitwise undo "I made a mess of the last 3 commits" --dry-run
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### `gitwise do "<natural language>"`
|
|
134
|
+
|
|
135
|
+
Convert plain English into a sequence of git commands, preview, then execute.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
gitwise do "stash my changes, switch to main, pull latest"
|
|
139
|
+
gitwise do "create a new branch called feature/auth and push it"
|
|
140
|
+
gitwise do "squash my last 3 commits" --dry-run
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
If any command fails, AI reads the error and suggests a fix.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `gitwise review`
|
|
148
|
+
|
|
149
|
+
Diffs your current branch vs main/master, then AI reviews for bugs, security issues, and quality.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
gitwise review
|
|
153
|
+
gitwise review --base develop # Compare against a different branch
|
|
154
|
+
gitwise review --dry-run # Show diff without AI review
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Review sections:** Summary · ⚠️ Potential Bugs · 🔒 Security Issues · 📏 Code Quality · 🔍 Things to Check · ✅ Overall Assessment
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### `gitwise pr`
|
|
162
|
+
|
|
163
|
+
Generates a complete PR title + description + bullet list + testing notes. Auto-copies to clipboard.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
gitwise pr
|
|
167
|
+
gitwise pr --base develop # Compare against develop
|
|
168
|
+
gitwise pr --no-copy # Don't copy to clipboard
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### `gitwise explain`
|
|
174
|
+
|
|
175
|
+
Reads your last 5 reflog entries and explains in plain English what happened.
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
gitwise explain
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### `gitwise whoops`
|
|
184
|
+
|
|
185
|
+
Emergency recovery. Feeds git status + log + reflog to AI. Diagnoses what went wrong and gives step-by-step recovery.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
gitwise whoops
|
|
189
|
+
gitwise whoops --dry-run # Diagnose only, don't execute
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### `gitwise config`
|
|
195
|
+
|
|
196
|
+
Interactive configuration wizard.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
gitwise config # Run setup
|
|
200
|
+
gitwise config --show # Print current config (keys masked)
|
|
201
|
+
gitwise config --reset # Wipe config and redo setup
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Stored settings:**
|
|
205
|
+
- AI provider (`gemini` / `groq` / `ollama` / `openai`)
|
|
206
|
+
- API key per provider
|
|
207
|
+
- Model name per provider
|
|
208
|
+
- Default branch (`main` or `master`)
|
|
209
|
+
- Commit style (`conventional` or `freeform`)
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 🏗️ Architecture
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
gitwise/
|
|
217
|
+
├── main.py # Typer app — all command definitions
|
|
218
|
+
├── ai.py # Unified AI provider wrapper (ask_ai)
|
|
219
|
+
├── git_ops.py # GitPython operations (diff, log, push, reset…)
|
|
220
|
+
├── config.py # Config at ~/.gitdude/config.json
|
|
221
|
+
└── utils.py # Rich panels, tables, prompts, helpers
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**AI Providers (`ai.py`):**
|
|
225
|
+
|
|
226
|
+
| Provider | SDK | Default Model | Speed | Cost |
|
|
227
|
+
|---|---|---|---|---|
|
|
228
|
+
| `gemini` | `google-generativeai` | `gemini-2.0-flash` | Fast | Free tier |
|
|
229
|
+
| `groq` | `groq` | `llama-3.3-70b-versatile` | Fastest | Free tier |
|
|
230
|
+
| `ollama` | `ollama` | `llama3` | Local | Free (local) |
|
|
231
|
+
| `openai` | `openai` | `gpt-4o-mini` | Fast | Pay per use |
|
|
232
|
+
|
|
233
|
+
All providers go through a single interface: `ask_ai(prompt) -> str` with spinner feedback and unified error handling.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 🛡️ Safety Features
|
|
238
|
+
|
|
239
|
+
- ✅ **All destructive operations** (hard reset, force push, etc.) require explicit confirmation
|
|
240
|
+
- ✅ **`--dry-run` flag** available on all mutating commands
|
|
241
|
+
- ✅ **Color-coded risk levels** — green (safe), yellow (caution), red (destructive)
|
|
242
|
+
- ✅ **No tracebacks** — all exceptions caught and shown as friendly Rich error panels
|
|
243
|
+
- ✅ **API keys** stored privately in `~/.gitdude/config.json`, never in project files
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 🤝 Contributing
|
|
248
|
+
|
|
249
|
+
1. Fork the repo
|
|
250
|
+
2. Create a feature branch: `git checkout -b feat/amazing-feature`
|
|
251
|
+
3. Make your changes
|
|
252
|
+
4. Run linting: `ruff check .`
|
|
253
|
+
5. Open a PR — or just use `gitwise pr` to generate your PR description! 😄
|
|
254
|
+
|
|
255
|
+
**Dev setup:**
|
|
256
|
+
```bash
|
|
257
|
+
git clone https://github.com/gitwise/gitwise
|
|
258
|
+
cd gitwise
|
|
259
|
+
pip install -e ".[dev]"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## 📄 License
|
|
265
|
+
|
|
266
|
+
MIT © GitWise Contributors
|