omni-dev 0.23.0

A powerful Git commit message analysis and amendment toolkit
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
# Troubleshooting Guide

Common issues and solutions when using omni-dev.

## Table of Contents

1. [Installation Issues]#installation-issues
2. [API Key Problems]#api-key-problems
3. [Configuration Issues]#configuration-issues
4. [Commit Analysis Problems]#commit-analysis-problems
5. [Performance Issues]#performance-issues
6. [Git Repository Issues]#git-repository-issues
7. [Command Line Issues]#command-line-issues
8. [Getting Help]#getting-help

## Installation Issues

### Error: `cargo install omni-dev` fails

**Symptom**: Installation fails with compilation errors.

**Common Causes & Solutions**:

1. **Rust Version Too Old**

   ```bash
   # Check Rust version
   rustc --version
   
   # Update Rust (need 1.70+)
   rustup update
   ```

2. **Missing System Dependencies**

   ```bash
   # macOS
   xcode-select --install
   
   # Ubuntu/Debian
   sudo apt update
   sudo apt install build-essential pkg-config libssl-dev
   
   # CentOS/RHEL
   sudo yum groupinstall "Development Tools"
   sudo yum install openssl-devel
   ```

3. **Network Issues**

   ```bash
   # Use alternative registry
   cargo install omni-dev --registry crates-io
   
   # Or build from source
   git clone https://github.com/rust-works/omni-dev.git
   cd omni-dev
   cargo build --release
   ```

### Error: `omni-dev: command not found`

**Symptom**: Command not found after installation.

**Solution**: Add Cargo bin directory to PATH:

```bash
# Add to your shell profile (.bashrc, .zshrc, etc.)
export PATH="$HOME/.cargo/bin:$PATH"

# Reload shell or run:
source ~/.bashrc  # or ~/.zshrc
```

## API Key Problems

### Error: `CLAUDE_API_KEY not found`

**Symptom**:

```
Error: Claude API key not found
  Caused by: API key not found
```

**Solutions**:

1. **Set Environment Variable**

   ```bash
   export CLAUDE_API_KEY="your-api-key-here"
   
   # Make permanent
   echo 'export CLAUDE_API_KEY="your-key"' >> ~/.bashrc
   source ~/.bashrc
   ```

2. **Verify Key Format**

   ```bash
   # Should start with "sk-ant-api03-"
   echo $CLAUDE_API_KEY | head -c 20
   ```

3. **Check for Hidden Characters**

   ```bash
   # Remove whitespace/newlines
   export CLAUDE_API_KEY="$(echo $CLAUDE_API_KEY | tr -d '[:space:]')"
   ```

### Error: `API request failed: HTTP 401`

**Symptom**: Authentication failed.

**Causes & Solutions**:

1. **Invalid API Key**
   - Get new key from [Anthropic Console]https://console.anthropic.com/
   - Ensure key is active and not expired

2. **Wrong Key Format**

   ```bash
   # API key should look like:
   sk-ant-api03-abcd1234...
   ```

3. **Account Issues**
   - Check account status at Anthropic Console
   - Ensure billing/credits are available

### Error: `API request failed: HTTP 429`

**Symptom**: Rate limited.

**Solutions**:

1. **Reduce Concurrency**

   ```bash
   # Lower parallel requests
   omni-dev git commit message twiddle 'HEAD~10..HEAD' --concurrency 1
   ```

2. **Wait and Retry**
   - Wait a few minutes between large requests
   - Rate limits reset over time

3. **Upgrade API Tier**
   - Check rate limits in Anthropic Console
   - Consider upgrading account tier

## Configuration Issues

### Error: Scopes not detected

**Symptom**: omni-dev doesn't use project-specific scopes.

**Debugging Steps**:

1. **Check Directory Structure**

   ```bash
   ls -la .omni-dev/
   # Should show: scopes.yaml, commit-guidelines.md
   ```

2. **Validate YAML Syntax**

   ```bash
   # Check YAML is valid
   python -c "import yaml; yaml.safe_load(open('.omni-dev/scopes.yaml'))"
   
   # Or use online YAML validator
   ```

3. **Test File Patterns**

   ```bash
   # See what files changed in commit
   git show --name-only HEAD
   
   # Check if patterns match
   grep -A5 "file_patterns" .omni-dev/scopes.yaml
   ```

4. **Use Absolute Context Directory**

   ```bash
   # Specify full path
   omni-dev git commit message twiddle 'HEAD~3..HEAD' --context-dir "$(pwd)/.omni-dev"
   ```

### Error: Context directory not found

**Symptom**:

```
Context directory not found: .omni-dev/
```

**Solutions**:

1. **Create Directory**

   ```bash
   mkdir .omni-dev
   ```

2. **Check Current Directory**

   ```bash
   # Must be in git repository root
   pwd
   git rev-parse --show-toplevel  # Should match
   ```

3. **Use Custom Directory**

   ```bash
   # If config is elsewhere
   omni-dev git commit message twiddle 'HEAD~3..HEAD' --context-dir ./config
   ```

### Error: YAML parsing failed

**Symptom**: Configuration file syntax errors.

**Solutions**:

1. **Check YAML Syntax**

   ```bash
   # Common issues:
   # - Tabs instead of spaces
   # - Missing quotes around strings with special chars
   # - Incorrect indentation
   
   # Validate with Python
   python -c "import yaml; print(yaml.safe_load(open('.omni-dev/scopes.yaml')))"
   ```

2. **Fix Common Issues**

   ```yaml
   # ❌ Bad - tabs used
   scopes:
    - name: "api"
   
   # ✅ Good - spaces used
   scopes:
     - name: "api"
   
   # ❌ Bad - unquoted string with colon
   - name: api: endpoints
   
   # ✅ Good - quoted string
   - name: "api: endpoints"
   ```

## Commit Analysis Problems

### Error: `Not in a git repository`

**Symptom**:

```
Error: Failed to open git repository
  Caused by: Not in a git repository
```

**Solutions**:

1. **Check Git Repository**

   ```bash
   git status  # Should work
   
   # If not a git repo:
   git init
   ```

2. **Check Working Directory**

   ```bash
   # Must be inside git repository
   cd /path/to/your/git/repo
   omni-dev git commit message twiddle 'HEAD~3..HEAD'
   ```

### Error: `Working directory is not clean`

**Symptom**:

```
Error: Cannot amend commits with uncommitted changes
  Caused by: Working directory is not clean
```

**Solutions**:

1. **Commit Changes**

   ```bash
   git add .
   git commit -m "temp commit"
   ```

2. **Stash Changes**

   ```bash
   git stash push -m "temp stash"
   # After omni-dev: git stash pop
   ```

3. **Use View Instead of Twiddle**

   ```bash
   # View doesn't require clean directory
   omni-dev git commit message view 'HEAD~3..HEAD'
   ```

### Error: Invalid commit range

**Symptom**:

```
Error: Invalid commit range: HEAD~100..HEAD
```

**Solutions**:

1. **Check Available Commits**

   ```bash
   # See how many commits exist
   git log --oneline | wc -l
   ```

2. **Use Valid Range**

   ```bash
   # If only 5 commits exist:
   omni-dev git commit message twiddle 'HEAD~5..HEAD'
   
   # Or use specific hashes:
   omni-dev git commit message twiddle 'abc123..def456'
   ```

3. **Check Branch History**

   ```bash
   git log --oneline -10  # See recent commits
   ```

### Error: No commits found in range

**Symptom**: Empty commit range or no commits to analyze.

**Solutions**:

1. **Verify Commit Range**

   ```bash
   # Check what's in range
   git log --oneline 'HEAD~3..HEAD'
   ```

2. **Use Different Range**

   ```bash
   # Compare to main branch
   omni-dev git commit message twiddle 'origin/main..HEAD'
   
   # Or use absolute range
   omni-dev git commit message twiddle 'HEAD~5..HEAD'
   ```

## Performance Issues

### Issue: Slow processing with large commit ranges

**Symptom**: omni-dev takes a long time with many commits.

**Solutions**:

1. **Reduce Concurrency**

   ```bash
   # Lower parallel requests
   omni-dev git commit message twiddle 'HEAD~20..HEAD' --concurrency 2
   ```

2. **Process in Stages**

   ```bash
   # Break up large ranges
   omni-dev git commit message twiddle 'HEAD~10..HEAD~5'
   omni-dev git commit message twiddle 'HEAD~5..HEAD'
   ```

3. **Save and Review**

   ```bash
   # Save suggestions first, then apply
   omni-dev git commit message twiddle 'HEAD~20..HEAD' --save-only suggestions.yaml
   omni-dev git commit message amend suggestions.yaml
   ```

### Issue: API timeouts

**Symptom**: Requests timing out or failing.

**Solutions**:

1. **Reduce Concurrency**

   ```bash
   omni-dev git commit message twiddle 'HEAD~10..HEAD' --concurrency 1
   ```

2. **Retry with Exponential Backoff**

   ```bash
   # Wait between retries
   sleep 30
   omni-dev git commit message twiddle 'HEAD~5..HEAD'
   ```

## Git Repository Issues

### Error: Cannot amend non-HEAD commits

**Symptom**: Trying to amend commits that aren't the latest.

**Expected Behavior**: omni-dev uses interactive rebase for non-HEAD commits.

**If Problems Occur**:

1. **Ensure Clean Working Directory**

   ```bash
   git status  # Should be clean
   ```

2. **Check Interactive Rebase Setup**

   ```bash
   # Set git editor if needed
   git config --global core.editor "nano"
   # or vim, code --wait, etc.
   ```

3. **Manual Rebase if Needed**

   ```bash
   # Do interactive rebase manually
   git rebase -i HEAD~5
   # Edit commit messages as needed
   ```

### Error: Remote branch not found

**Symptom**: Can't find origin/main or base branch.

**Solutions**:

1. **Check Remote Branches**

   ```bash
   git branch -r  # See remote branches
   ```

2. **Update Remote References**

   ```bash
   git fetch origin
   ```

3. **Use Correct Branch Name**

   ```bash
   # If main branch is 'master':
   omni-dev git commit message twiddle 'origin/master..HEAD'
   ```

### Error: Merge conflicts during rebase

**Symptom**: Interactive rebase fails with conflicts.

**Solutions**:

1. **Resolve Conflicts Manually**

   ```bash
   # Edit conflicted files
   git add .
   git rebase --continue
   ```

2. **Abort and Try Different Approach**

   ```bash
   git rebase --abort
   
   # Use smaller commit ranges
   omni-dev git commit message twiddle 'HEAD~3..HEAD'
   ```

## Command Line Issues

### Error: Unknown argument

**Symptom**:

```
error: unexpected argument '--unknown-flag' found
```

**Solutions**:

1. **Check Available Options**

   ```bash
   omni-dev git commit message twiddle --help
   ```

2. **Use Correct Flag Names**

   ```bash
   # Common correct flags:
   --use-context
   --concurrency 4
   --no-coherence
   --auto-apply
   --save-only file.yaml
   --context-dir ./config
   ```

### Error: Invalid commit range format

**Symptom**: Git range syntax errors.

**Valid Formats**:

```bash
# ✅ Valid ranges:
'HEAD~5..HEAD'          # Last 5 commits
'origin/main..HEAD'     # Current branch vs main
'abc123..def456'        # Between specific commits
'HEAD^..HEAD'           # Just last commit

# ❌ Invalid:
HEAD~5..HEAD           # Missing quotes
'HEAD-5..HEAD'         # Wrong syntax (-5 instead of ~5)
'HEAD..HEAD~5'         # Backwards range
```

### Issue: Quotes and Shell Escaping

**Symptom**: Shell interpreting range characters incorrectly.

**Solutions**:

```bash
# ✅ Always quote commit ranges:
omni-dev git commit message twiddle 'HEAD~5..HEAD'

# ✅ Or escape special characters:
omni-dev git commit message twiddle HEAD~5..HEAD

# On Windows Command Prompt:
omni-dev git commit message twiddle "HEAD~5..HEAD"
```

## Getting Help

### Enable Debug Output

omni-dev uses the standard Rust logging system via the `RUST_LOG` environment variable. This provides detailed diagnostic information for troubleshooting.

#### Basic Usage

```bash
# Enable debug output for all omni-dev components
RUST_LOG=omni_dev=debug omni-dev git commit message twiddle 'HEAD~3..HEAD' --use-context

# Enable all debug logging (including dependencies)
RUST_LOG=debug omni-dev git commit message twiddle 'HEAD~3..HEAD'

# Only show errors and warnings
RUST_LOG=warn omni-dev git commit message twiddle 'HEAD~3..HEAD'
```

#### Log Levels (in order of verbosity)

- `error` - Only errors
- `warn` - Warnings and errors (default)  
- `info` - Informational messages + above
- `debug` - Debug information + above
- `trace` - Most verbose logging + above

#### Module-Specific Logging

Target specific components for focused debugging:

```bash
# Debug only context discovery
RUST_LOG=omni_dev::claude::context::discovery=debug omni-dev git commit message twiddle ...

# Debug only Claude API interactions
RUST_LOG=omni_dev::claude::client=debug omni-dev git commit message twiddle ...

# Debug only CLI processing
RUST_LOG=omni_dev::cli=debug omni-dev git commit message twiddle ...

# Multiple modules
RUST_LOG=omni_dev::claude=debug,omni_dev::git=info omni-dev git commit message twiddle ...
```

#### Common Debugging Scenarios

**Configuration Issues:**
```bash
# See what config files are loaded
RUST_LOG=omni_dev::claude::context::discovery=debug omni-dev git commit message twiddle ...
```

**API Communication Problems:**
```bash  
# Debug Claude API calls
RUST_LOG=omni_dev::claude::client=debug omni-dev git commit message twiddle ...
```

**YAML Parsing Errors:**
```bash
# See raw Claude responses and parsing details
RUST_LOG=omni_dev::claude=debug omni-dev git commit message twiddle ...
```

#### Output Format

Debug output includes:
- **Timestamp** - When the event occurred
- **Level** - Log level (DEBUG, INFO, etc.)
- **Module** - Which component generated the log
- **Message** - The log message with structured fields
- **Context** - Additional structured data (file paths, sizes, etc.)

Example output:
```
2025-09-09T14:42:46.673223Z DEBUG omni_dev::claude::context::discovery: Looking for context directory context_dir="./.omni-dev" exists=true
2025-09-09T14:42:46.673282Z DEBUG omni_dev::claude::context::discovery: Loaded commit guidelines bytes=1449
```

### Collect System Information

When reporting issues, include:

```bash
# System info
uname -a
rustc --version
cargo --version

# Git info  
git --version
git status
git log --oneline -5

# omni-dev info
omni-dev --version

# Configuration
ls -la .omni-dev/
echo "API key length: $(echo $CLAUDE_API_KEY | wc -c)"
```

### Test with Minimal Example

Create a minimal reproduction:

```bash
# Create test repo
mkdir test-omni-dev
cd test-omni-dev
git init

# Create test commits
echo "first" > file.txt
git add file.txt
git commit -m "first commit"

echo "second" > file.txt
git add file.txt  
git commit -m "second commit"

# Test omni-dev
omni-dev git commit message twiddle 'HEAD^..HEAD' --use-context
```

### Common Solutions Checklist

Before asking for help, verify:

- [ ] omni-dev is latest version: `cargo install omni-dev`
- [ ] CLAUDE_API_KEY is set correctly
- [ ] In a git repository: `git status` works
- [ ] Working directory is clean (for twiddle command)
- [ ] Commit range is valid: `git log --oneline 'HEAD~5..HEAD'`
- [ ] Configuration syntax is correct (if using `.omni-dev/`)

## Support Channels

### GitHub Issues

For bugs and feature requests: <https://github.com/rust-works/omni-dev/issues>

**Include in Bug Reports**:

- omni-dev version: `omni-dev --version`
- Rust version: `rustc --version`  
- Operating system
- Complete error message
- Steps to reproduce
- Minimal example if possible

### GitHub Discussions  

For questions and general help: <https://github.com/rust-works/omni-dev/discussions>

### Community Support

- Tag questions with `omni-dev` on Stack Overflow
- Join Rust community channels and ask about Git tools

### Documentation

- [User Guide]user-guide.md - Complete usage guide
- [Configuration Guide]configuration.md - Setup instructions
- [Examples]examples.md - Real-world examples

## Frequently Asked Questions

### Q: Can I use omni-dev without Claude API key?

**A**: No, the AI-powered features require a Claude API key. However, you
can use the `view` command to analyze commits without AI suggestions.

### Q: Does omni-dev modify my git history?

**A**: Only when you explicitly approve changes. The `view` command is
read-only. The `twiddle` command shows you proposed changes and asks for
confirmation before applying.

### Q: Can I undo changes made by omni-dev?

**A**: Yes, git tracks all changes:

```bash
# See recent changes
git reflog

# Undo last change
git reset --hard HEAD@{1}
```

### Q: Is it safe to use on shared/public repositories?

**A**: Yes, but be careful:

- Always review changes before applying
- Don't rewrite history on shared branches
- Consider using `--save-only` for review workflows

### Q: How much does the Claude API cost?

**A**: Check current pricing at
[Anthropic Pricing](https://anthropic.com/pricing). Typical usage for commit
message improvement is very low cost.

### Q: Can I use this in CI/CD pipelines?

**A**: Yes, but consider:

- Store API key as secure secret
- Use `--auto-apply` for automated workflows
- Test thoroughly in development first
- Be mindful of API rate limits