# Version 0.1.7 - Path Check Fix

Released: October 15, 2025

## Overview

This release fixes a bug where users would see a confusing traceback when the `claude` CLI was not in their PATH. The error handling has been improved to show a clear, actionable error message instead.

## Bug Fixes

### Claude CLI Path Detection

**Problem:** When running `ccg update-usage` (or any command that tracks limits) without the `claude` CLI in PATH, users would see:

```
Saved 19 new token records
[DEBUG] capture_limits failed: [Errno 2] No such file or directory: 'claude'
Traceback (most recent call last):
  File ".../limits.py", line 42, in capture_limits
    process = subprocess.Popen(['claude', '/usage'], ...)
  ...
FileNotFoundError: [Errno 2] No such file or directory: 'claude'
```

**Solution:** Added early PATH checking with graceful error handling:

```python
# Check if claude CLI is available
if not shutil.which('claude'):
    return {
        "error": "claude_not_found",
        "message": "Claude Code CLI not found in PATH. Please install Claude Code or ensure 'claude' is available in your PATH."
    }
```

**New user experience:**

```
Saved 19 new token records
⚠ Claude Code CLI not found in PATH. Please install Claude Code or ensure 'claude' is available in your PATH.
Skipping limits tracking. Token tracking will continue.
```

## Technical Changes

- Added `shutil.which()` check in `capture_limits()` before attempting to run `claude`
- Removed debug traceback printing in exception handler
- Added user-friendly warning messages in all commands that use `capture_limits()`:
  - `ccg update-usage`
  - `ccg usage`
  - `ccg stats`
  - `ccg export`
  - `ccg limits`
  - `ccg status-bar` (macOS)
- Token tracking continues to work even when `claude` CLI is not found

## Documentation Updates

- Added PATH setup instructions to README "First-Time Setup" section
- Added new troubleshooting section: "Claude Code CLI not found in PATH"
- Clarified that token tracking works independently of limits tracking

## Upgrading

```bash
pip install --upgrade claude-goblin
```

Existing users who don't have `claude` in their PATH will now see helpful error messages instead of tracebacks.

## Files Modified

- `src/commands/limits.py` - Added PATH check and improved error handling
- `src/commands/update_usage.py` - Added error message display
- `src/commands/usage.py` - Added error message display
- `src/commands/stats.py` - Added error message display
- `src/commands/export.py` - Added error message display
- `README.md` - Added PATH setup and troubleshooting
- `CHANGELOG.md` - Version 0.1.7 entry
- `pyproject.toml` - Version bump to 0.1.7
