Skip to main content

Module utils

Module utils 

Source

Constants§

RESET
ANSI reset code

Functions§

format_duration_ms
Format duration in milliseconds to human-readable string
format_duration_secs
Format duration in seconds to human-readable string (e.g., “2d 5h”, “3h 15m”, “45m 30s”)
get_claude_config_dir
Claude Code’s config directory: CLAUDE_CONFIG_DIR when set, else ~/.claude
get_home_dir
Get home directory path (cross-platform)
get_terminal_width
Get terminal width, returns default from config as fallback
get_username
Get current username from environment
reasoning_label_from_payload
Build a reasoning-mode label from the Claude Code payload (effort.level, thinking.enabled). Prefers the live effort.level value, falling back to the thinking.enabled flag.
truncate_with_ellipsis
Truncate string with ellipsis while preserving ANSI codes
visible_len
Calculate visible width in terminal columns (strips ANSI and measures Unicode width)