* feat(timer): add compact time format option for timer widgets
Add an optional compact display mode (s key) to BlockTimer, BlockResetTimer,
and WeeklyResetTimer that renders durations as '5h30m' instead of '5hr 30m'.
- Add `compact` boolean parameter to `formatUsageDuration`
- Add `isUsageCompact` / `toggleUsageCompact` helpers in usage-display.ts
- Add `toggle-compact` action and `s` keybind across all three timer widgets
- Preview text reflects compact format when flag is set
- Editor modifier text shows 'compact' when flag is enabled
- Tests cover compact format output, keybind exposure, and toggle behavior
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix compact timer widget editor state
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat(list): add custom list component
* feat(list): add sublabel and disabled options for list items
* Refactor TUI menu screens onto shared List component
Replace the remaining menu-style terminal and powerline screens with the shared List component so they share navigation, descriptions, back-row behavior, disabled states, and confirm dialog rendering.
This migrates TerminalOptionsMenu, TerminalWidthMenu, PowerlineSetup, PowerlineThemeSelector, and ConfirmDialog, and adds focused tests for the extracted menu builders and Ink-level regressions.
It also fixes two regressions uncovered during manual testing: PowerlineThemeSelector now memoizes theme data and List selection callbacks so live theme preview no longer triggers a maximum update depth loop, and TerminalWidthMenu now restores focus to the active full-until-compact row after returning from threshold entry instead of resetting to the first item.
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: Add Skills widget with cross-platform hook framework
Replaces bash/jq hook with a built-in --hook CLI handler that works
on all platforms. Widgets can declare hooks via getHooks() which are
auto-synced to Claude settings when the statusline config is saved.
* feat: tighten hook lifecycle and upgrade skills widget
Notes:\n- Hook sync now follows saved-state semantics: installing statusline syncs hooks from saved ccstatusline settings on disk, and uninstall always removes all ccstatusline-managed hooks.\n- syncWidgetHooks always strips managed hooks first, including when statusline.command is missing, then persists cleanup.\n- Skills metrics storage path is now ~/.cache/ccstatusline/skills/skills-<sessionId>.jsonl.\n- Skills unique list ordering is now most-recent-first.\n- Skills widget updates: view toggle on (v), hide-when-empty toggle on (h), explicit empty outputs when not hidden, and new list-only (l)imit editor option where 0 means unlimited (default).\n- Added list-limit custom editor flow and list-only keybind visibility in ItemsEditor.\n- Maintained Node 14 compatibility by avoiding Array.prototype.at in skills metrics parsing.\n- Added/updated regression tests for hook sync/install/uninstall behavior, skills metrics path/order, Skills widget rendering/editing, and items-editor custom keybind handling.
* chore: bump version to 2.2.1 and update release notes
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* Add Dependabot configuration for npm and GitHub Actions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: use bun ecosystem and add Dependabot cooldowns
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* fix: support bare repo worktrees in GitWorktree widget
The GitWorktree widget now correctly detects worktrees from bare
repositories. Previously, it only checked for `.git/worktrees/` in
the path, but bare repos store worktree metadata at
`<bare-repo>/worktrees/<name>` without the `.git` prefix.
This adds an additional check for `/worktrees/` pattern when the
`.git/worktrees/` pattern isn't found.
Fixes detection for setups like:
- Bare repo at: /path/to/repo (contains objects/, refs/, HEAD, etc.)
- Worktree at: /path/to/repo/trees/feature-x
- Git dir: /path/to/repo/worktrees/feature-x
* chore: remove accidental npm lockfile from PR branch
* chore: bump version to 2.1.10 and update recent updates
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* Add GitHub CI workflow for lint, test, and build
Runs on push to main and PRs. Uses Bun with dependency caching.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove branch filter on push trigger to run CI on all branches
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Use bun test in CI test job
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* Add --config flag for custom settings file path
Allow users to specify an alternative settings file via `--config <path>`,
enabling distinct status line configs for different Claude Code instances.
- Add initConfigPath/getConfigPath/isCustomConfigPath to config.ts
- Fix backup path to always append .bak instead of replacing .json suffix
- Use path.dirname(SETTINGS_PATH) instead of CONFIG_DIR for mkdir
- Parse --config arg in ccstatusline.ts main() entry point
- Add tests for config path management
* Integrate --config flag with Claude Code install commands
When a custom config path is active, the install-to-Claude-Code feature
now appends --config <path> to the status line command. Also updates
isInstalled detection to recognize commands with the --config suffix.
- Add isKnownCommand() to deduplicate command-matching logic
- Add shell-safe path quoting for --config values with spaces/special chars
- Add buildCommand() to append --config when custom path is active
- Refactor isInstalled() to use isKnownCommand()
- Use isKnownCommand() in App.tsx install flow
- Add tests for isKnownCommand() and buildCommand() with CLAUDE_CONFIG_DIR safety net
* Show custom config path in TUI header
When a custom --config path is active, display it below the title bar
so users can see which settings file is being edited.
* fix: use platform-appropriate quoting for --config path
* chore: bump version to 2.1.8 and update recent updates
---------
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
Handle [1M], (1M), and optional context labels when inferring model context size; use model id + display_name in context widgets and add regression coverage for ctx, ctx(u), and context bar.
Closes#193
- add a new Link widget with OSC8 rendering, preview parity, and raw mode behavior
- fix truncation and visible-width calculation to handle ANSI/OSC sequences safely
- bump package version to 2.1.3
- update README recent updates and widget documentation
Resolves#188
On Windows, the Unix-specific commands (ps, stty, tput) and shell
redirects (2>/dev/null) don't work and cause issues:
- tput doesn't exist on Windows
- 2>/dev/null creates a literal file named "null" instead of
redirecting stderr
This fix adds a platform check at the start of getTerminalWidth()
and canDetectTerminalWidth(). We cannot rely on process.stdout.columns when run as a subprocess of claude code to tell us the actual terminal width. By simply returning that terminal width detection is unavailable on windows, we avoid the empty file being created, and disable explicit truncation behavior since we can't detect the width.
Fixes#117🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: preserve legacy terminal width behavior on Windows
Return null/false for win32 in terminal width helpers to keep width detection disabled on Windows and avoid Unix-style fallback paths that can create C:\dev\null.
---------
Co-authored-by: ItsDaRa <ItsDaRa@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* feat: add API usage widgets (session, weekly, reset timer, context bar)
Add four new widgets that display Claude Code API usage data:
- session-usage: 5-hour session utilization with progress bar
- weekly-usage: 7-day utilization with progress bar
- reset-timer: countdown to session reset
- context-bar: context window usage with progress bar
Fetches data from /api/oauth/usage using existing OAuth credentials
(macOS Keychain + Linux file fallback). Includes 180s cache with
30s rate limiting to minimize API calls.
Also enhances ContextPercentage widget to use context_window data
from Claude Code's stdin JSON when available.
Closes#94
* fix(api-usage): zod-validate usage data and move cache to ~/.cache/ccstatusline
- parse credentials/cache/API response via zod with nullable field support\n- move usage cache+lock to ~/.cache/ccstatusline/usage.{json,lock}\n- add missing getCategory() methods on API usage widgets\n- resolve context percentage brace-style lint issue
* Refactor usage widgets and unify timer/usage display modes
Split API usage widgets into dedicated files and a shared usage utility, replacing the monolithic ApiUsage widget module.
Key changes:
- add src/utils/usage.ts for API fetch/caching, parsing, error mapping, progress-bar helpers, and shared 5-hour window math
- move widgets to standalone files: SessionUsage, WeeklyUsage, ResetTimer, ContextBar
- remove src/widgets/ApiUsage.tsx and update widget exports/registry wiring
- make BlockTimer usage-aware with usage API first and JSONL fallback via shared resolver
- make ResetTimer follow BlockTimer UX: time/progress/short-progress modes, raw value support, invert toggle, and JSONL fallback when usage timing is unavailable
- make SessionUsage and WeeklyUsage match timer interaction model: progress mode cycling, invert toggle, invert-clearing when returning to text mode, and raw-value support
- update ItemsEditor to hide/disable invert keybind when widget is in text mode
- remove eager block-metric parsing from ccstatusline render path so JSONL fallback is only invoked when usage timing is missing
- add comprehensive tests for usage window fallback behavior and widget mode/toggle/raw output behavior
Validation:
- bun test
- bun run lint
* Prefer status JSON context-window metrics with robust fallbacks
- add a shared context-window metrics utility to normalize context_window fields (window size, percentages, usage, and token snapshots)
- make context window size from status JSON authoritative for context calculations when present; derive usable limit as 80% of reported size
- keep model-id fallback behavior for missing context_window data, including case-insensitive [1m]/[1M] detection
- update Context %, Context % (usable), Context Length, and Context Bar to use status JSON first and fall back to JSONL token metrics when needed
- update Session Clock to use cost.total_duration_ms first with JSONL duration fallback
- keep Tokens Input/Output JSON-first, while reverting Tokens Cached/Total to cumulative session JSONL totals
- simplify render pipeline behavior to always parse current session JSONL token metrics when transcript_path exists
- add/expand tests for context-window parsing, denominator precedence, 1M-without-suffix scenarios, case-insensitive suffix fallback, token widget source behavior, context bar rendering, and session clock behavior
* Align Context Bar with Context Length semantics
- switch Context Bar usage basis from total current_usage (input+output+cache) to context-length usage (input+cache), matching Context Length widget
- keep statusline JSON-first behavior with JSONL/model fallbacks unchanged
- keep short-by-default progress mode and long/short toggle behavior
- update ContextBar tests for new token basis and progress-mode expectations
* usage: honor CLAUDE_CONFIG_DIR and use runtime-safe HTTPS API fetch
* Fix context bar overflow and preserve usage error states
* Group usage widgets under new Usage picker category
* Rename context remaining toggle to used/remaining shortcut
---------
Co-authored-by: Peter van Velzen <pvvelzen@emico.nl>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* FreeMemory widget:
Description: Shows system memory usage (used/total) in a compact format like Mem: 12.4G/16.0G
Features:
- On macOS: Uses vm_stat to calculate memory like htop (Active + Wired pages)
- On other platforms: Falls back to Node.js os.freemem()/os.totalmem()
- Smart byte formatting (G, M, K, B)
- Supports raw value mode (omits "Mem:" prefix)
- Default color: cyan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Version bump and README update
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>
* perf: cache block timer metrics to reduce I/O
Cache block start time to ~/.cache/ccstatusline/block-cache.json to avoid
parsing all JSONL files on every status line render. Cache is invalidated
when the 5-hour block expires.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use hashed per-config block cache files
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com>