howmuchleft v0.14.1 /internal/platform
On this page

Detects the Claude Code session directory, profile name, Claude Code version from environment, and active GitHub username via gh CLI.

#internal/platform

#internal/platform

#GetActiveGhUser

Go go
func GetActiveGhUser(claudeDir string) string

GetActiveGhUser returns the GitHub username for the current GH_TOKEN, or "" if no token is set or the lookup fails. Results are cached both on disk and in process memory (subsequent calls never re-read or re-run gh).

#ResetGhUserCache

Go go
func ResetGhUserCache()

ResetGhUserCache clears the per-process cache (for testing only).

#GhTokenHash

Go go
func GhTokenHash(token string) string

GhTokenHash is exported for testing.

#GetSessionElapsed

Go go
func GetSessionElapsed(claudeDir string) *int64

GetSessionElapsed returns the session elapsed time in milliseconds by finding the Claude Code session file for an ancestor PID. Returns nil if not found.

#GetClaudeDir

Go go
func GetClaudeDir() string

GetClaudeDir returns the Claude configuration directory path. Priority: positional arg > CLAUDE_CONFIG_DIR env > ~/.claude

#GetProfileName

Go go
func GetProfileName(claudeDir string) string

GetProfileName extracts the profile name from the claude directory basename. Returns "" for the default .claude dir (profile not shown).

#GetCCVersion

Go go
func GetCCVersion() string

GetCCVersion extracts the Claude Code version from environment variables. Returns "" if neither CLAUDE_CODE_EXECPATH nor AI_AGENT is set.

Search