* Add Git Root Dir widget
Add a new widget that displays the git repository root directory name.
- Shows directory name with 📁 icon (e.g., "📁 my-repo")
- Supports rawValue option for icon-free display
- Supports hideNoGit option to hide message when not in a git repo
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Change Git Root Dir widget icon to text label
Replace 📁 emoji with "Repo:" text label for better compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove label from Git Root Dir widget
Display only the repository name without any prefix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix GitRootDir root path handling and raw mode
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* Add Session Name widget
Adds a native widget to display the Claude Code session name set via the
/rename command. The widget reads the transcript file and extracts the
customTitle from custom-title entries.
- New SessionName widget with rawValue support
- 9 unit tests
- README documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: add category metadata to session name widget
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: add abbreviate home option to Current Working Directory widget
Add a new 'abbreviate home' toggle (h key) that replaces the home
directory path with ~ (e.g., /Users/matt/Projects → ~/Projects).
- Can be combined with segments for paths like ~/.../Projects/my-project
- Mutually exclusive with fish-style abbreviation
- Includes tests for the new functionality
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: correct cwd home abbreviation edge cases
Preserve platform path separators when combining home abbreviation with segments.
Require exact home-directory boundary matching to avoid false substitutions.
Align one-segment abbreviateHome preview with runtime output.
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
The getContextConfig function was hardcoded to only match
claude-sonnet-4-5 models with the [1m] suffix. Other models like
claude-opus-4-6[1m] also support 1M context but were falling back to
the 200k default, causing incorrect context percentage display.
The [1m] suffix itself is sufficient to indicate 1M context regardless
of model family.
* fix(test): replace vi.mocked with direct mock reference in GitWorktree tests
vi.mocked(execSync) was undefined because the vi.mock factory runs
before imports resolve. Use a top-level vi.fn() reference instead.
* feat(tui): add move mode to LineSelector for reordering lines
Press 'm' to enter move mode, use arrow keys to swap lines,
Enter/Escape to exit. Visual feedback mirrors ItemsEditor pattern
with blue diamond marker and [MOVE MODE] label.
* chore: update bun.lock
* Fix for model in statusLine JSON being passed as string vs object, closes#157, version bump
* fix(test): make GitWorktree execSync mock hoist-safe
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: Add Claude Session ID widget
* Add ClaudeSessionIdWidget to widget registry, add label, support raw mode, fix cross-platform issues by using session ID directly from statusline JSON
---------
Co-authored-by: Marty <marty@croakingtoad.com>
Co-authored-by: Matthew Breedlove <matt@revenite.ai>
* Fix: Dynamic context window calculation for Sonnet 4.5 (1M tokens)
- Create model-context utility with dynamic context window mapping
- Sonnet 4.5 models now use 1M context (800k usable)
- Older models default to 200k context (160k usable)
- Update ContextPercentage and ContextPercentageUsable widgets
- Update renderer.ts flex mode calculations (2 locations)
- Add comprehensive test coverage (14 new tests, 36 total passing)
Fixes incorrect percentage display for Sonnet 4.5:
- Before: 42k tokens showed 21.0% (using 200k denominator)
- After: 42k tokens shows 4.2% (using 1M denominator)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Style: Apply ESLint auto-fixes for consistency
- Standardize indentation to 4 spaces
- Apply formatting rules from eslint.config.js
- No logic changes, formatting only
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Refactor: Code review fixes for context window changes
- Fix misleading test name (line 69 of context-percentage.test.ts)
- Strengthen model ID pattern matching (claude-sonnet-4-5 vs sonnet-4-5)
- Standardize export style (inline export for consistency)
All tests passing (19/19 for affected files)
TypeScript and ESLint checks passed
* Enhance CLAUDE.md: Update piped input example for Sonnet 4.5 and add test commands
- Changed piped input example to reflect the new model ID for Claude 4.5
- Added instructions for running tests and tests in watch mode
- Updated context window metrics description to include dynamic model-based context windows
Improves clarity and usability for developers working with the project.
* Fix: Require [1m] suffix for Sonnet 4.5 1M context window detection
Address PR feedback that Sonnet 4.5 only has 1M context on API usage
when the model ID includes the [1m] suffix (long context beta access).
Changes:
- Update getContextConfig() to check for [1m] suffix (case-insensitive)
- Models without suffix now safely default to 200K context
- Add comprehensive test coverage for suffix detection
- Update all test fixtures to use correct model ID format
- Document suffix requirement in CLAUDE.md
This ensures conservative behavior - only models with explicit [1m]
suffix receive 1M context allocation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* chore: automatic change from linting
* feat: support CLAUDE_CONFIG_DIR on utilities
* feat: support CLAUDE_CONFIG_DIR from the main app UI
* fix: reduce duplication and handle installation using new constants
* feat: missed one place using hardcoded path
* chore: update CLAUDE.md
* docs: Update README
Investigation revealed that Claude Code now appends synthetic error messages to transcript files when API errors occur (rate limits, authentication failures, etc.).
These synthetic messages have:
- model: "<synthetic>"
- isApiErrorMessage: true
- All token usage fields set to 0
The getTokenMetrics() function in src/utils/jsonl.ts calculates the current context length by finding the most recent main chain entry(isSidechain !== true) sorted by timestamp. When an API error occurs, the synthetic error message becomes the "most recent entry", causing contextLength to be calculated as 0.
* revert 798b637
* Fix#88: Fix Block Timer showing incorrect elapsed time due to flawed block calculation
\## Problem
The Block Timer widget was displaying incorrect elapsed times when multiple work sessions occurred on the same day with gaps between them. For example, with work sessions at:
- Morning: 11:00-16:00 (first message at 11:42, last at 14:52)
- Evening: 17:00-22:00 (first message at 17:44)
At 20:10, the Block Timer showed **4hr 10m** instead of the expected **3hr 10m**.
\## Root Cause
The existing algorithm in `findMostRecentBlockStartTime()` had a fundamental flaw in how it calculated block start times:
1. It correctly identified continuous work by finding gaps ≥ 5 hours
2. It floored the continuous work start to the hour
3. **But then it used `Math.floor(totalWorkTime / sessionDurationMs)` to calculate the current block**
This division-based approach assumed continuous 5-hour blocks without gaps:
```
[Block 0: 11:00-16:00][Block 1: 16:00-21:00]...
```
In reality, blocks have gaps between them:
```
[Block 0: 11:00-16:00]--gap--[Block 1: 17:00-22:00]...
```
\### Incorrectly Identified Cases
The algorithm failed in scenarios where:
- **Multiple work sessions with small gaps** (< 5 hours): Treated them as one continuous session and calculated wrong block boundaries
- **Current time in a gap**: Could incorrectly show elapsed time from a previous block
- **Messages spanning multiple days**: Division logic ignored actual message timestamps and gaps
\### Example of the Bug
With messages at 11:42 and 17:44, gap of ~2h 52m:
1. No 5-hour gap found → continuous work from 11:00
2. At 20:10: `totalWorkTime = 9h 10m`
3. `completedBlocks = floor(9.17 / 5) = 1`
4. `blockStart = 11:00 + (1 × 5h) = 16:00`
5. Elapsed = 20:10 - 16:00 = **4h 10m** (wrong!)
Correct calculation should be:
- Block 1: 11:00-16:00 (ended)
- Gap: 16:00-17:44
- Block 2: 17:00-22:00 (current)
- Elapsed = 20:10 - 17:00 = **3h 10m** ✓
\## Solution
Replaced the flawed division-based calculation with a proper block-building algorithm:
1. **Find definitive boundary**: Look back for 5+ hour gap (or start of data)
2. **Build blocks forward from timestamps**:
- Sort timestamps chronologically
- For each timestamp after the boundary:
- If no current block OR timestamp is after current block end: start new block (floor to hour, add 5h for end)
- Otherwise: timestamp is within current block
3. **Find current block**: Check if `now` falls within any constructed block's timespan
4. **Return block start** if found and has activity, otherwise null
This correctly handles gaps of any size and builds the actual block structure from message timestamps.
\## Tests Added
Created comprehensive unit tests in `src/utils/__tests__/jsonl.test.ts` covering:
\### Real Scenarios
- **Morning and evening blocks with gap**: Messages at 11:42 and 17:44 → correctly identifies 17:00 block start at 20:10
- **Multiple messages in single block**: Messages within 5 hours → single block with floored start time
- **Multi-block scenario**: Messages at 00:13, 05:56, 06:01, 14:33, 20:01 → correctly identifies 20:00 block at 22:43
\### Edge Cases
- **Current time in gap between blocks**: Returns null (no active block)
- **No messages within 5 hours**: Returns null (session expired)
- **Block boundary timing**: Correctly handles time exactly at 5-hour boundary
- **5+ hour gap detection**: Properly detects boundary when gap ≥ 5 hours
- **Messages at exact hour boundaries**: Handles flooring when message is already at :00
\### Invalid Inputs
- **Empty content**: Returns null
- **Invalid JSON**: Returns null gracefully
All tests pass with the corrected algorithm, ensuring the Block Timer and Five Hour Moons widgets now display accurate elapsed times.
---------
Co-authored-by: alexander.buyanov <alexander.buyanov@konux.de>
Detect block boundaries after 60 minutes of inactivity instead of requiring a 5-hour gap.
This prevents block start times from carrying over into short midday breaks and ensures elapsed time matches ccusage.
Co-authored-by: alexander.buyanov <alexander.buyanov@konux.de>
* feat: Add fish-style path abbreviation to CurrentWorkingDir widget
- Added new toggle option for fish-style path abbreviation
- Keeps home directory as ~, first and last directories complete
- Abbreviates middle directories to first letter only
- Preserves dot for hidden directories (e.g. .config → .c)
- Maintains backward compatibility with segments feature
- Both options are mutually exclusive (fish-style takes precedence)
Example: ~/Documents/Projects/my-project → ~/D/P/my-project
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Modify cwd widget fish-style code to use handleEditorAction instead of renderEditor, misc lint fixes
---------
Co-authored-by: Jishuai <aqianlikuaizaifeng@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Block windows were staying “active” after multiple hours with no token usage, so the block timer kept counting even though ccusage reported the session closed.
Aligning the activity detection with actual token usage prevents those phantom sessions and keeps the timer in sync with the upstream report.
Co-authored-by: alexander.buyanov <alexander.buyanov@konux.de>
- Enhanced separator rendering to check all previous widgets for actual content
- Prevents separators from being skipped when there are widgets that don't render but others before them do
- Improves status line layout consistency by properly detecting content presence