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
func GetActiveGhUser(claudeDir string) stringGetActiveGhUser 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
func ResetGhUserCache()ResetGhUserCache clears the per-process cache (for testing only).
#GhTokenHash
func GhTokenHash(token string) stringGhTokenHash is exported for testing.
#GetSessionElapsed
func GetSessionElapsed(claudeDir string) *int64GetSessionElapsed returns the session elapsed time in milliseconds by finding the Claude Code session file for an ancestor PID. Returns nil if not found.
#GetClaudeDir
func GetClaudeDir() stringGetClaudeDir returns the Claude configuration directory path. Priority: positional arg > CLAUDE_CONFIG_DIR env > ~/.claude
#GetProfileName
func GetProfileName(claudeDir string) stringGetProfileName extracts the profile name from the claude directory basename. Returns "" for the default .claude dir (profile not shown).
#GetCCVersion
func GetCCVersion() stringGetCCVersion extracts the Claude Code version from environment variables. Returns "" if neither CLAUDE_CODE_EXECPATH nor AI_AGENT is set.