whogitit 1.0.0

Track AI-generated code at line-level granularity
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# Troubleshooting

Common issues and their solutions.

> **Tip:** Run `whogitit doctor` first to diagnose most configuration issues automatically.

## Installation Issues

### `whogitit` command not found

**Symptoms:**
```text
bash: whogitit: command not found
```

**Solutions:**

1. **Check if installed:**
   ```bash
   ls ~/.cargo/bin/whogitit
   ```

2. **Add cargo bin to PATH:**
   ```bash
   # Add to ~/.bashrc or ~/.zshrc
   export PATH="$HOME/.cargo/bin:$PATH"

   # Reload
   source ~/.bashrc
   ```

3. **Reinstall:**
   ```bash
   cargo install --path /path/to/whogitit --force
   ```

### Build fails

**Symptoms:**
```text
error[E0433]: failed to resolve: could not find `xyz` in `abc`
```

**Solutions:**

1. **Update Rust:**
   ```bash
   rustup update stable
   ```

2. **Clean and rebuild:**
   ```bash
   cargo clean
   cargo build --release
   ```

3. **Check dependencies:**
   ```bash
   cargo update
   ```

## Capture Issues

### No attribution data after commit

**Symptoms:**
- `whogitit status` shows "No pending AI attribution"
- `whogitit show HEAD` shows no attribution

**Quick Fix:**

Run the doctor command to diagnose:
```bash
whogitit doctor
```

If doctor shows issues, run setup to fix them:
```bash
whogitit setup
```

**Manual Solutions:**

1. **Check Claude hooks are configured:**
   ```bash
   cat ~/.claude/settings.json | jq '.hooks'
   ```

   Should show PreToolUse and PostToolUse entries.

2. **Check capture script exists:**
   ```bash
   ls -la ~/.claude/hooks/whogitit-capture.sh
   ```

3. **Check capture script is executable:**
   ```bash
   chmod +x ~/.claude/hooks/whogitit-capture.sh
   ```

4. **Check debug logs:**
   ```bash
   cat .whogitit/state/hook-debug.log
   cat .whogitit/state/hook-errors.log
   ```

5. **Verify whogitit binary path:**
   ```bash
   # In capture script, check WHOGITIT_BIN
   which whogitit
   ```

### Pending buffer not updating

**Symptoms:**
- Making edits with Claude but `whogitit status` shows old data

**Solutions:**

1. **Check you're in a git repo:**
   ```bash
   git rev-parse --show-toplevel
   ```

2. **Check pending file location:**
   ```bash
   ls -la .whogitit-pending.json
   ```

3. **Clear stale data and try again:**
   ```bash
   whogitit clear
   ```

### Only some files tracked

**Symptoms:**
- Some AI edits are tracked, others aren't

**Solutions:**

1. **Check tool matcher in settings.json:**
   ```json
   "matcher": "Edit|Write|Bash"
   ```

   Make sure all relevant tools are included.

2. **For Bash commands:** The hook tracks file changes. Ensure the files exist before the command.

## Git Hooks Issues

### post-commit hook not running

**Symptoms:**
- Commits work but no attribution is created

**Solutions:**

1. **Check hook exists:**
   ```bash
   ls -la .git/hooks/post-commit
   ```

2. **Check hook is executable:**
   ```bash
   chmod +x .git/hooks/post-commit
   ```

3. **Check hook content:**
   ```bash
   cat .git/hooks/post-commit
   ```

   Should contain `whogitit post-commit`.

4. **Reinstall hooks:**
   ```bash
   whogitit init
   ```

### pre-push hook failing

**Symptoms:**
```text
error: failed to push some refs to 'origin'
```

**Solutions:**

1. **Push notes manually:**
   ```bash
   git push origin refs/notes/whogitit
   ```

2. **Check for notes divergence:**
   ```bash
   git fetch origin refs/notes/whogitit
   git log refs/notes/whogitit..FETCH_HEAD
   ```

3. **Force push notes (caution):**
   ```bash
   git push origin refs/notes/whogitit --force
   ```

## Notes Issues

### Notes not visible after clone

**Symptoms:**
- Cloned repo, but `whogitit blame` shows no AI attribution

**Solutions:**

1. **Fetch notes:**
   ```bash
   git fetch origin refs/notes/whogitit:refs/notes/whogitit
   ```

2. **Verify notes exist on remote:**
   ```bash
   git ls-remote origin refs/notes/whogitit
   ```

3. **Configure auto-fetch:**
   ```bash
   git config --add remote.origin.fetch '+refs/notes/whogitit:refs/notes/whogitit'
   ```

### Notes missing after rebase

**Symptoms:**
- After rebasing, attribution data is gone

**Cause:**
Git notes are attached to specific commit SHAs. Rebase creates new SHAs.

**Solutions:**

1. **Install the post-rewrite hook (recommended):**
   ```bash
   whogitit init
   ```

   This installs a `post-rewrite` hook that automatically preserves attribution during rebase and amend operations. Run this once per repository.

2. **Manually copy notes after the fact:**
   ```bash
   whogitit copy-notes <old-sha> <new-sha>
   ```

3. **For cherry-pick (not covered by hook):**
   ```bash
   whogitit copy-notes <original-sha> <cherry-picked-sha>
   ```

### Corrupt note data

**Symptoms:**
```text
Error: invalid JSON in note
```

**Solutions:**

1. **View raw note:**
   ```bash
   git notes --ref=whogitit show <commit> | cat
   ```

2. **Remove corrupt note:**
   ```bash
   git notes --ref=whogitit remove <commit>
   ```

3. **Recreate if pending buffer exists:** Not possible after buffer is cleared.

## Output Issues

### JSON parse errors

**Symptoms:**
```text
Error: expected value at line 1 column 1
```

**Solutions:**

1. **Check for empty output:**
   ```bash
   whogitit show HEAD 2>&1 | head -1
   ```

2. **Verify note exists:**
   ```bash
   git notes --ref=whogitit show HEAD
   ```

### Blame shows all "Unknown"

**Symptoms:**
- `whogitit blame` shows `?` for all lines

**Cause:**
- File not in any commit with attribution
- Attribution data doesn't include this file

**Solutions:**

1. **Check if file has attribution:**
   ```bash
   whogitit show HEAD | grep -i "filename"
   ```

2. **Check commit history:**
   ```bash
   git log --oneline -- <file>
   ```

## Performance Issues

### Slow blame on large files

**Symptoms:**
- `whogitit blame` takes long time on large files

**Solutions:**

1. **Use `--revision` to limit scope:**
   ```bash
   whogitit blame --revision HEAD~10 <file>
   ```

2. **Use JSON output for scripting:**
   ```bash
   whogitit blame --format json <file>
   ```

### Large pending buffer

**Symptoms:**
- `.whogitit-pending.json` is very large

**Solutions:**

1. **Commit more frequently:** Pending buffer grows with each edit.

2. **Clear and restart:**
   ```bash
   whogitit clear
   ```

### `Attribution payload is too large for a git note`

**Symptoms:**
```text
Error: Attribution payload is too large for a git note
```

**Cause:**
- A single commit generated an unusually large attribution payload (note hard limit is 4 MiB)

**Solutions:**

1. **Split the work into smaller commits:** commit focused file groups instead of one large sweep.
2. **Trim oversized prompts:** very long prompts increase payload size.
3. **Clear stale pending state if needed:**
   ```bash
   whogitit clear
   ```

## Getting Help

### Run Doctor First

The doctor command checks all configuration automatically:

```bash
whogitit doctor
```

It verifies:
- whogitit binary is installed
- Capture hook is installed and executable
- Claude Code settings are configured
- Required tools (jq) are available
- Repository hooks are installed (if in a git repo)

If any checks fail, it provides fix hints.

### Debug Mode

Enable verbose logging:

```bash
# For capture hook
export WHOGITIT_HOOK_DEBUG=1

# Then use Claude Code, check:
cat .whogitit/state/hook-debug.log
```

### Reporting Issues

When reporting issues, include:

1. **whogitit version:**
   ```bash
   whogitit --version
   ```

2. **OS and shell:**
   ```bash
   uname -a
   echo $SHELL
   ```

3. **Relevant logs:**
   ```bash
   cat .whogitit/state/hook-debug.log
   cat .whogitit/state/hook-errors.log
   ```

4. **Steps to reproduce**

Report at: https://github.com/dotsetlabs/whogitit/issues

## See Also

- [Installation]../getting-started/installation.md - Setup guide
- [Hook System]../reference/hooks.md - Hook details
- [FAQ]./faq.md - Common questions