git-wtf 0.1.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.
- git_wtf-0.1.0/.gitignore +5 -0
- git_wtf-0.1.0/PKG-INFO +232 -0
- git_wtf-0.1.0/README.md +203 -0
- git_wtf-0.1.0/git_wtf/__init__.py +1 -0
- git_wtf-0.1.0/git_wtf/cli.py +114 -0
- git_wtf-0.1.0/git_wtf/collectors/__init__.py +0 -0
- git_wtf-0.1.0/git_wtf/collectors/conflict.py +147 -0
- git_wtf-0.1.0/git_wtf/collectors/context.py +144 -0
- git_wtf-0.1.0/git_wtf/collectors/git_state.py +177 -0
- git_wtf-0.1.0/git_wtf/commands/__init__.py +0 -0
- git_wtf-0.1.0/git_wtf/commands/diagnose.py +130 -0
- git_wtf-0.1.0/git_wtf/commands/merge.py +239 -0
- git_wtf-0.1.0/git_wtf/commands/setup.py +239 -0
- git_wtf-0.1.0/git_wtf/config.py +152 -0
- git_wtf-0.1.0/git_wtf/llm/__init__.py +0 -0
- git_wtf-0.1.0/git_wtf/llm/client.py +124 -0
- git_wtf-0.1.0/git_wtf/llm/prompts.py +320 -0
- git_wtf-0.1.0/git_wtf/resolver.py +131 -0
- git_wtf-0.1.0/git_wtf/ui.py +234 -0
- git_wtf-0.1.0/pyproject.toml +52 -0
git_wtf-0.1.0/.gitignore
ADDED
git_wtf-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-wtf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-powered git assistant for when git is being git
|
|
5
|
+
Project-URL: Homepage, https://github.com/git-wtf/git-wtf
|
|
6
|
+
Project-URL: Repository, https://github.com/git-wtf/git-wtf
|
|
7
|
+
Project-URL: Issues, https://github.com/git-wtf/git-wtf/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/git-wtf/git-wtf/releases
|
|
9
|
+
Author-email: git-wtf <hi@git-wtf.sh>
|
|
10
|
+
License: MIT
|
|
11
|
+
Keywords: ai,cli,conflict,developer-tools,git,merge
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
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.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: httpx>=0.25.0
|
|
26
|
+
Requires-Dist: openai>=1.30.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# git-wtf
|
|
31
|
+
|
|
32
|
+
> AI-powered git assistant. For when git is being git.
|
|
33
|
+
|
|
34
|
+
Two commands that cover 90% of the pain:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
git wtf # diagnose whatever broken state you're in
|
|
38
|
+
git wtf merge # resolve merge conflicts — semantically, not just line-by-line
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Built for vibe coders who are moving fast with AI tools. When you hit a merge conflict on code you didn't write and don't have time to read, `git wtf merge` reads both sides, understands what each branch was *trying to do*, merges them properly, explains what it did in plain English, and asks you to confirm before touching a single file.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## install
|
|
46
|
+
|
|
47
|
+
**macOS (Homebrew)**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
brew tap git-wtf/tap
|
|
51
|
+
brew install git-wtf
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Any OS (pip)**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install git-wtf
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Any OS (pipx — recommended if you use pipx)**
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pipx install git-wtf
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Git automatically picks up `git-wtf` as a subcommand. No PATH tricks, no aliases required.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## setup
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git wtf setup
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Interactive. Takes ~30 seconds. Three options:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
1 Anthropic api.anthropic.com → Claude
|
|
80
|
+
2 OpenAI api.openai.com → GPT-4o, o3, ...
|
|
81
|
+
3 Proxy corporate / LiteLLM / custom endpoint
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Option 1 — Anthropic (direct)**
|
|
85
|
+
|
|
86
|
+
Get your key at [console.anthropic.com](https://console.anthropic.com), paste it in, pick a model. Done.
|
|
87
|
+
|
|
88
|
+
**Option 2 — OpenAI (direct)**
|
|
89
|
+
|
|
90
|
+
Get your key at [platform.openai.com](https://platform.openai.com), paste it in. Done.
|
|
91
|
+
|
|
92
|
+
**Option 3 — Proxy / corporate**
|
|
93
|
+
|
|
94
|
+
Paste your proxy base URL (e.g. `https://llm-proxy.yourcompany.com/v1`), paste the key if required. The tool fetches the available model list from the proxy and lets you pick. SSL verification is automatically disabled for corporate MITM setups.
|
|
95
|
+
|
|
96
|
+
Config is saved to `~/.config/git-wtf/config.json`.
|
|
97
|
+
|
|
98
|
+
### env vars (override config file)
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
GITWFT_API_KEY=... # API key
|
|
102
|
+
GITWFT_BASE_URL=... # custom base URL
|
|
103
|
+
GITWFT_MODEL=... # model override
|
|
104
|
+
GITWFT_VERIFY_SSL=false # disable SSL verification
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Standard `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` are also picked up automatically.
|
|
108
|
+
|
|
109
|
+
### opencode users
|
|
110
|
+
|
|
111
|
+
If you use [opencode](https://opencode.ai), git-wtf reads your `~/.config/opencode/opencode.json` automatically and routes through the same proxy. Zero extra config.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## usage
|
|
116
|
+
|
|
117
|
+
### `git wtf`
|
|
118
|
+
|
|
119
|
+
Diagnoses whatever state your repo is in. Detached HEAD, mid-merge, diverged from remote, unresolved conflicts — it reads the git state, figures out what happened, and tells you exactly what to run.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
__ _(_) |_ __ _____ __
|
|
123
|
+
/ _` | | _| \ V V / '_ \
|
|
124
|
+
\__, |_|\__| \_/\_/ | .__/
|
|
125
|
+
|___/ |_|
|
|
126
|
+
|
|
127
|
+
feat/onboarding → origin/feat/onboarding
|
|
128
|
+
|
|
129
|
+
↓ 3 behind MID-MERGE 2 CONFLICTS
|
|
130
|
+
|
|
131
|
+
──────────────────────────── diagnosis ────────────────────────────
|
|
132
|
+
|
|
133
|
+
## what happened
|
|
134
|
+
ok so basically you're in the middle of a merge that hit conflicts.
|
|
135
|
+
git is frozen waiting for you to resolve them...
|
|
136
|
+
|
|
137
|
+
## how to fix it
|
|
138
|
+
1. run `git wtf merge` to resolve conflicts automatically
|
|
139
|
+
2. run `git merge --continue` to finish the merge
|
|
140
|
+
...
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `git wtf merge`
|
|
144
|
+
|
|
145
|
+
The main thing. Reads both sides of every conflict, understands the intent behind each, and produces a resolution that keeps both features intact — not just picking a winner.
|
|
146
|
+
|
|
147
|
+
**The trust flow (this is the important part):**
|
|
148
|
+
|
|
149
|
+
After resolving all conflicts, before writing a single file, it shows you:
|
|
150
|
+
|
|
151
|
+
1. A per-file panel — what each file does now, confidence rating (HIGH / MEDIUM / LOW), and any warnings about things it wasn't sure about
|
|
152
|
+
2. A plain-English summary of the entire merge — what the app will *do* after this, what trade-offs were made, anything that needs manual review
|
|
153
|
+
3. A single `apply this merge? [Y/n]` prompt
|
|
154
|
+
|
|
155
|
+
Nothing is written to disk until you say Y.
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
feat/chat-agent + feat/onboarding → 3 conflicted files
|
|
159
|
+
|
|
160
|
+
(1/3) src/auth.ts 2 hunks MEDIUM
|
|
161
|
+
(2/3) src/api/client.ts 1 hunk HIGH
|
|
162
|
+
(3/3) src/user.ts 3 hunks HIGH
|
|
163
|
+
|
|
164
|
+
────────────────────── what i'm about to change ───────────────────
|
|
165
|
+
|
|
166
|
+
╭────── src/auth.ts MEDIUM 2 hunks ─────────────────────────╮
|
|
167
|
+
│ │
|
|
168
|
+
│ fetchUser now uses the shared httpClient AND sends the auth │
|
|
169
|
+
│ token as a Bearer header. logout clears localStorage, the │
|
|
170
|
+
│ httpClient cache, AND sessionStorage — all three steps kept. │
|
|
171
|
+
│ │
|
|
172
|
+
│ ⚠ verify httpClient.get() accepts a headers config object │
|
|
173
|
+
│ before shipping │
|
|
174
|
+
╰───────────────────────────────────────────────────────────────────╯
|
|
175
|
+
|
|
176
|
+
───────────────────────── the big picture ─────────────────────────
|
|
177
|
+
|
|
178
|
+
╭────────────── what this merge will do ─────────────────────────╮
|
|
179
|
+
│ │
|
|
180
|
+
│ • fetchUser now uses the shared HTTP client AND sends auth │
|
|
181
|
+
│ • logout does a full triple cleanup — nothing left behind │
|
|
182
|
+
│ • onboarding auth + chat-agent HTTP refactor coexist cleanly │
|
|
183
|
+
│ │
|
|
184
|
+
│ ⚠ NEEDS MANUAL REVIEW: httpClient.get() headers assumption │
|
|
185
|
+
│ │
|
|
186
|
+
│ vibe check: clean merge, one loose wire — verify before ship │
|
|
187
|
+
╰───────────────────────────────────────────────────────────────────╯
|
|
188
|
+
|
|
189
|
+
3 files resolved · nothing written to disk yet
|
|
190
|
+
|
|
191
|
+
apply this merge? [Y/n]
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## how it works
|
|
197
|
+
|
|
198
|
+
1. **Reads git state** — `git status`, `git log`, branch info, merge state
|
|
199
|
+
2. **Parses conflict markers** — extracts the three blob versions (`:1:` ancestor, `:2:` yours, `:3:` theirs) for full file context
|
|
200
|
+
3. **Reads project context** — `README.md`, `package.json`, `CLAUDE.md` / `.cursorrules` so the LLM knows what you're building
|
|
201
|
+
4. **One LLM call per conflicted file** — sends both branch commit histories, both full file versions, and each conflict hunk with surrounding context
|
|
202
|
+
5. **Self-validates** — if hunk count doesn't match, skips the file and tells you to resolve manually
|
|
203
|
+
6. **Summary call** — a second LLM call synthesises all per-file resolutions into a plain-English "what this merge will do" summary
|
|
204
|
+
7. **You confirm** — one Y/n. Then it writes and `git add`s everything.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## confidence levels
|
|
209
|
+
|
|
210
|
+
Every resolved file gets a confidence rating:
|
|
211
|
+
|
|
212
|
+
| Level | Meaning |
|
|
213
|
+
|-------|---------|
|
|
214
|
+
| **HIGH** | both changes are in clearly different parts of the code, no semantic overlap |
|
|
215
|
+
| **MEDIUM** | changes interact — resolution is probably right but verify the integration |
|
|
216
|
+
| **LOW** | genuinely ambiguous — the LLM resolved it but you should read this one manually |
|
|
217
|
+
|
|
218
|
+
LOW confidence files always get a `⚠ heads up` block in the panel explaining exactly what to check.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## what it doesn't do (yet)
|
|
223
|
+
|
|
224
|
+
- Rebase conflict resolution
|
|
225
|
+
- Multi-file semantic understanding (e.g. a type changed in one file and needs updating in five others)
|
|
226
|
+
- Auto-commit after merge
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## license
|
|
231
|
+
|
|
232
|
+
MIT
|
git_wtf-0.1.0/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# git-wtf
|
|
2
|
+
|
|
3
|
+
> AI-powered git assistant. For when git is being git.
|
|
4
|
+
|
|
5
|
+
Two commands that cover 90% of the pain:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
git wtf # diagnose whatever broken state you're in
|
|
9
|
+
git wtf merge # resolve merge conflicts — semantically, not just line-by-line
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Built for vibe coders who are moving fast with AI tools. When you hit a merge conflict on code you didn't write and don't have time to read, `git wtf merge` reads both sides, understands what each branch was *trying to do*, merges them properly, explains what it did in plain English, and asks you to confirm before touching a single file.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## install
|
|
17
|
+
|
|
18
|
+
**macOS (Homebrew)**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
brew tap git-wtf/tap
|
|
22
|
+
brew install git-wtf
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Any OS (pip)**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install git-wtf
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Any OS (pipx — recommended if you use pipx)**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pipx install git-wtf
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Git automatically picks up `git-wtf` as a subcommand. No PATH tricks, no aliases required.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## setup
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git wtf setup
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Interactive. Takes ~30 seconds. Three options:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
1 Anthropic api.anthropic.com → Claude
|
|
51
|
+
2 OpenAI api.openai.com → GPT-4o, o3, ...
|
|
52
|
+
3 Proxy corporate / LiteLLM / custom endpoint
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Option 1 — Anthropic (direct)**
|
|
56
|
+
|
|
57
|
+
Get your key at [console.anthropic.com](https://console.anthropic.com), paste it in, pick a model. Done.
|
|
58
|
+
|
|
59
|
+
**Option 2 — OpenAI (direct)**
|
|
60
|
+
|
|
61
|
+
Get your key at [platform.openai.com](https://platform.openai.com), paste it in. Done.
|
|
62
|
+
|
|
63
|
+
**Option 3 — Proxy / corporate**
|
|
64
|
+
|
|
65
|
+
Paste your proxy base URL (e.g. `https://llm-proxy.yourcompany.com/v1`), paste the key if required. The tool fetches the available model list from the proxy and lets you pick. SSL verification is automatically disabled for corporate MITM setups.
|
|
66
|
+
|
|
67
|
+
Config is saved to `~/.config/git-wtf/config.json`.
|
|
68
|
+
|
|
69
|
+
### env vars (override config file)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
GITWFT_API_KEY=... # API key
|
|
73
|
+
GITWFT_BASE_URL=... # custom base URL
|
|
74
|
+
GITWFT_MODEL=... # model override
|
|
75
|
+
GITWFT_VERIFY_SSL=false # disable SSL verification
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Standard `OPENAI_API_KEY` and `ANTHROPIC_API_KEY` are also picked up automatically.
|
|
79
|
+
|
|
80
|
+
### opencode users
|
|
81
|
+
|
|
82
|
+
If you use [opencode](https://opencode.ai), git-wtf reads your `~/.config/opencode/opencode.json` automatically and routes through the same proxy. Zero extra config.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## usage
|
|
87
|
+
|
|
88
|
+
### `git wtf`
|
|
89
|
+
|
|
90
|
+
Diagnoses whatever state your repo is in. Detached HEAD, mid-merge, diverged from remote, unresolved conflicts — it reads the git state, figures out what happened, and tells you exactly what to run.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
__ _(_) |_ __ _____ __
|
|
94
|
+
/ _` | | _| \ V V / '_ \
|
|
95
|
+
\__, |_|\__| \_/\_/ | .__/
|
|
96
|
+
|___/ |_|
|
|
97
|
+
|
|
98
|
+
feat/onboarding → origin/feat/onboarding
|
|
99
|
+
|
|
100
|
+
↓ 3 behind MID-MERGE 2 CONFLICTS
|
|
101
|
+
|
|
102
|
+
──────────────────────────── diagnosis ────────────────────────────
|
|
103
|
+
|
|
104
|
+
## what happened
|
|
105
|
+
ok so basically you're in the middle of a merge that hit conflicts.
|
|
106
|
+
git is frozen waiting for you to resolve them...
|
|
107
|
+
|
|
108
|
+
## how to fix it
|
|
109
|
+
1. run `git wtf merge` to resolve conflicts automatically
|
|
110
|
+
2. run `git merge --continue` to finish the merge
|
|
111
|
+
...
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `git wtf merge`
|
|
115
|
+
|
|
116
|
+
The main thing. Reads both sides of every conflict, understands the intent behind each, and produces a resolution that keeps both features intact — not just picking a winner.
|
|
117
|
+
|
|
118
|
+
**The trust flow (this is the important part):**
|
|
119
|
+
|
|
120
|
+
After resolving all conflicts, before writing a single file, it shows you:
|
|
121
|
+
|
|
122
|
+
1. A per-file panel — what each file does now, confidence rating (HIGH / MEDIUM / LOW), and any warnings about things it wasn't sure about
|
|
123
|
+
2. A plain-English summary of the entire merge — what the app will *do* after this, what trade-offs were made, anything that needs manual review
|
|
124
|
+
3. A single `apply this merge? [Y/n]` prompt
|
|
125
|
+
|
|
126
|
+
Nothing is written to disk until you say Y.
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
feat/chat-agent + feat/onboarding → 3 conflicted files
|
|
130
|
+
|
|
131
|
+
(1/3) src/auth.ts 2 hunks MEDIUM
|
|
132
|
+
(2/3) src/api/client.ts 1 hunk HIGH
|
|
133
|
+
(3/3) src/user.ts 3 hunks HIGH
|
|
134
|
+
|
|
135
|
+
────────────────────── what i'm about to change ───────────────────
|
|
136
|
+
|
|
137
|
+
╭────── src/auth.ts MEDIUM 2 hunks ─────────────────────────╮
|
|
138
|
+
│ │
|
|
139
|
+
│ fetchUser now uses the shared httpClient AND sends the auth │
|
|
140
|
+
│ token as a Bearer header. logout clears localStorage, the │
|
|
141
|
+
│ httpClient cache, AND sessionStorage — all three steps kept. │
|
|
142
|
+
│ │
|
|
143
|
+
│ ⚠ verify httpClient.get() accepts a headers config object │
|
|
144
|
+
│ before shipping │
|
|
145
|
+
╰───────────────────────────────────────────────────────────────────╯
|
|
146
|
+
|
|
147
|
+
───────────────────────── the big picture ─────────────────────────
|
|
148
|
+
|
|
149
|
+
╭────────────── what this merge will do ─────────────────────────╮
|
|
150
|
+
│ │
|
|
151
|
+
│ • fetchUser now uses the shared HTTP client AND sends auth │
|
|
152
|
+
│ • logout does a full triple cleanup — nothing left behind │
|
|
153
|
+
│ • onboarding auth + chat-agent HTTP refactor coexist cleanly │
|
|
154
|
+
│ │
|
|
155
|
+
│ ⚠ NEEDS MANUAL REVIEW: httpClient.get() headers assumption │
|
|
156
|
+
│ │
|
|
157
|
+
│ vibe check: clean merge, one loose wire — verify before ship │
|
|
158
|
+
╰───────────────────────────────────────────────────────────────────╯
|
|
159
|
+
|
|
160
|
+
3 files resolved · nothing written to disk yet
|
|
161
|
+
|
|
162
|
+
apply this merge? [Y/n]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## how it works
|
|
168
|
+
|
|
169
|
+
1. **Reads git state** — `git status`, `git log`, branch info, merge state
|
|
170
|
+
2. **Parses conflict markers** — extracts the three blob versions (`:1:` ancestor, `:2:` yours, `:3:` theirs) for full file context
|
|
171
|
+
3. **Reads project context** — `README.md`, `package.json`, `CLAUDE.md` / `.cursorrules` so the LLM knows what you're building
|
|
172
|
+
4. **One LLM call per conflicted file** — sends both branch commit histories, both full file versions, and each conflict hunk with surrounding context
|
|
173
|
+
5. **Self-validates** — if hunk count doesn't match, skips the file and tells you to resolve manually
|
|
174
|
+
6. **Summary call** — a second LLM call synthesises all per-file resolutions into a plain-English "what this merge will do" summary
|
|
175
|
+
7. **You confirm** — one Y/n. Then it writes and `git add`s everything.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## confidence levels
|
|
180
|
+
|
|
181
|
+
Every resolved file gets a confidence rating:
|
|
182
|
+
|
|
183
|
+
| Level | Meaning |
|
|
184
|
+
|-------|---------|
|
|
185
|
+
| **HIGH** | both changes are in clearly different parts of the code, no semantic overlap |
|
|
186
|
+
| **MEDIUM** | changes interact — resolution is probably right but verify the integration |
|
|
187
|
+
| **LOW** | genuinely ambiguous — the LLM resolved it but you should read this one manually |
|
|
188
|
+
|
|
189
|
+
LOW confidence files always get a `⚠ heads up` block in the panel explaining exactly what to check.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## what it doesn't do (yet)
|
|
194
|
+
|
|
195
|
+
- Rebase conflict resolution
|
|
196
|
+
- Multi-file semantic understanding (e.g. a type changed in one file and needs updating in five others)
|
|
197
|
+
- Auto-commit after merge
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## license
|
|
202
|
+
|
|
203
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entry point for the git-wtf CLI.
|
|
3
|
+
|
|
4
|
+
Registered as `git-wtf` binary via pyproject.toml [project.scripts].
|
|
5
|
+
Git picks it up automatically as a subcommand: `git wtf [subcommand]`
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
from rich.console import Console
|
|
13
|
+
|
|
14
|
+
console = Console()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _not_configured_error() -> None:
|
|
18
|
+
console.print(
|
|
19
|
+
"\n[red]git-wtf is not configured.[/red]\n\n"
|
|
20
|
+
"run this to get set up in ~30 seconds:\n\n"
|
|
21
|
+
" [bold]git wtf setup[/bold]\n"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main() -> None:
|
|
26
|
+
parser = argparse.ArgumentParser(
|
|
27
|
+
prog="git-wtf",
|
|
28
|
+
description="AI-powered git assistant. For when git is being git.",
|
|
29
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
30
|
+
epilog=(
|
|
31
|
+
"commands:\n"
|
|
32
|
+
" git wtf diagnose current repo state\n"
|
|
33
|
+
" git wtf merge resolve merge conflicts with AI\n"
|
|
34
|
+
" git wtf setup configure API key and provider\n"
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
parser.add_argument(
|
|
39
|
+
"command",
|
|
40
|
+
nargs="?",
|
|
41
|
+
choices=["merge", "setup"],
|
|
42
|
+
help="subcommand (omit to diagnose current state)",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
parser.add_argument(
|
|
46
|
+
"--version",
|
|
47
|
+
action="version",
|
|
48
|
+
version="git-wtf 0.1.0",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
parser.add_argument(
|
|
52
|
+
"--dir",
|
|
53
|
+
metavar="PATH",
|
|
54
|
+
default=None,
|
|
55
|
+
help="run as if started in PATH (default: current directory)",
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--debug",
|
|
60
|
+
action="store_true",
|
|
61
|
+
help="print resolved config before running",
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
parser.add_argument(
|
|
65
|
+
"--chaos",
|
|
66
|
+
action="store_true",
|
|
67
|
+
help="show chaos level score for the current repo state",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
parser.add_argument(
|
|
71
|
+
"--blame",
|
|
72
|
+
action="store_true",
|
|
73
|
+
help="show who last touched each conflicted file and who initiated the merge",
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
args = parser.parse_args()
|
|
77
|
+
|
|
78
|
+
# ── setup is always available, no config required ────────────────────────
|
|
79
|
+
if args.command == "setup":
|
|
80
|
+
from git_wtf.commands.setup import run
|
|
81
|
+
sys.exit(run())
|
|
82
|
+
|
|
83
|
+
# ── debug: show resolved config ──────────────────────────────────────────
|
|
84
|
+
if args.debug:
|
|
85
|
+
from git_wtf import config as cfg_module
|
|
86
|
+
cfg = cfg_module.load()
|
|
87
|
+
if cfg:
|
|
88
|
+
console.print(f"\n[dim]config:[/dim]")
|
|
89
|
+
console.print(f" provider : {cfg.provider}")
|
|
90
|
+
console.print(f" model : {cfg.model}")
|
|
91
|
+
console.print(f" base_url : {cfg.base_url or 'sdk default'}")
|
|
92
|
+
console.print(f" verify_ssl: {cfg.verify_ssl}")
|
|
93
|
+
console.print(f" api_key : {'set' if cfg.api_key else 'NOT SET'}\n")
|
|
94
|
+
else:
|
|
95
|
+
_not_configured_error()
|
|
96
|
+
sys.exit(1)
|
|
97
|
+
|
|
98
|
+
# ── guard: must be configured for all other commands ────────────────────
|
|
99
|
+
from git_wtf import config as cfg_module
|
|
100
|
+
if not cfg_module.is_configured():
|
|
101
|
+
_not_configured_error()
|
|
102
|
+
sys.exit(1)
|
|
103
|
+
|
|
104
|
+
# ── dispatch ─────────────────────────────────────────────────────────────
|
|
105
|
+
if args.command == "merge":
|
|
106
|
+
from git_wtf.commands.merge import run
|
|
107
|
+
sys.exit(run(cwd=args.dir))
|
|
108
|
+
else:
|
|
109
|
+
from git_wtf.commands.diagnose import run
|
|
110
|
+
sys.exit(run(cwd=args.dir, show_chaos=args.chaos, show_blame=args.blame))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if __name__ == "__main__":
|
|
114
|
+
main()
|
|
File without changes
|