@owloops/claude-powerline 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -92,7 +92,7 @@ npx -y @owloops/claude-powerline --install-fonts
92
92
  {
93
93
  "statusLine": {
94
94
  "type": "command",
95
- "command": "npx -y @owloops/claude-powerline --style=powerline",
95
+ "command": "npx -y @owloops/claude-powerline@latest --style=powerline",
96
96
  "padding": 0
97
97
  }
98
98
  }
@@ -123,7 +123,6 @@ Options are specified by command line flags. Overall configuration can also use
123
123
  | `--theme` | `dark` (default), `light`, `nord`, `tokyo-night`, `rose-pine`, `custom` | Set color theme |
124
124
  | `--style` | `minimal` (default), `powerline` | Set separator style |
125
125
  | `--usage` | `cost`, `tokens`, `both`, `breakdown` | Set usage display format |
126
- | `--daily-budget` | `AMOUNT` | Set daily budget limit in USD |
127
126
  | `--session-budget` | `AMOUNT` | Set session budget limit in USD |
128
127
  | `--config` | `PATH` | Use custom config file path |
129
128
  | `--install-fonts` | - | Install powerline fonts to system |
@@ -162,8 +161,8 @@ claude-powerline --theme=tokyo-night --style=minimal
162
161
  # Show token breakdown instead of costs
163
162
  claude-powerline --usage=breakdown
164
163
 
165
- # Set daily budget limit
166
- claude-powerline --daily-budget=50
164
+ # Set session budget limit
165
+ claude-powerline --session-budget=50
167
166
  ```
168
167
 
169
168
  ### Status Indicators
package/dist/index.js CHANGED
@@ -1447,7 +1447,6 @@ Claude Code Options (for settings.json):
1447
1447
  --style=STYLE Set separator style: minimal, powerline
1448
1448
  --usage=TYPE Usage display: cost, tokens, both, breakdown
1449
1449
  --session-budget=AMOUNT Set session budget for percentage tracking
1450
- --daily-budget=AMOUNT Set daily budget for percentage tracking
1451
1450
  --config=PATH Use custom config file path
1452
1451
 
1453
1452
  Configuration:
@@ -1497,7 +1496,7 @@ echo '{"session_id":"test-session","workspace":{"project_dir":"/path/to/project"
1497
1496
  const hookData = await json(process2.stdin);
1498
1497
  debug(`Received hook data:`, JSON.stringify(hookData, null, 2));
1499
1498
  if (!hookData) {
1500
- console.error("Error: No input provided");
1499
+ console.error("Error: No input data received from stdin");
1501
1500
  console.log(`
1502
1501
  claude-powerline - Beautiful powerline statusline for Claude Code
1503
1502
 
@@ -1508,7 +1507,6 @@ Options:
1508
1507
  --style=STYLE Set separator style: minimal, powerline
1509
1508
  --usage=TYPE Usage display: cost, tokens, both, breakdown
1510
1509
  --session-budget=AMOUNT Set session budget for percentage tracking
1511
- --daily-budget=AMOUNT Set daily budget for percentage tracking
1512
1510
  --config=PATH Use custom config file path
1513
1511
  --install-fonts Install powerline fonts to system
1514
1512
  -h, --help Show this help
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/utils/colors.ts","../src/themes/dark.ts","../src/themes/light.ts","../src/themes/nord.ts","../src/themes/tokyo-night.ts","../src/themes/rose-pine.ts","../src/themes/index.ts","../src/segments/git.ts","../src/utils/logger.ts","../src/segments/tmux.ts","../src/segments/session.ts","../src/segments/pricing.ts","../src/segments/context.ts","../src/utils/formatters.ts","../src/utils/budget.ts","../src/segments/renderer.ts","../src/powerline.ts","../src/config/loader.ts","../src/config/defaults.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { execSync } from \"node:child_process\";\nimport os from \"node:os\";\nimport { json } from \"node:stream/consumers\";\nimport { PowerlineRenderer } from \"./powerline\";\nimport { loadConfigFromCLI } from \"./config/loader\";\nimport { debug } from \"./utils/logger\";\nexport interface ClaudeHookData {\n hook_event_name: string;\n session_id: string;\n transcript_path: string;\n cwd: string;\n model: {\n id: string;\n display_name: string;\n };\n workspace: {\n current_dir: string;\n project_dir: string;\n };\n}\n\nasync function installFonts(): Promise<void> {\n try {\n const platform = os.platform();\n let fontDir: string;\n\n if (platform === \"darwin\") {\n fontDir = path.join(os.homedir(), \"Library\", \"Fonts\");\n } else if (platform === \"linux\") {\n fontDir = path.join(os.homedir(), \".local\", \"share\", \"fonts\");\n } else if (platform === \"win32\") {\n fontDir = path.join(\n os.homedir(),\n \"AppData\",\n \"Local\",\n \"Microsoft\",\n \"Windows\",\n \"Fonts\"\n );\n } else {\n console.log(\"Unsupported platform for font installation\");\n return;\n }\n\n if (!fs.existsSync(fontDir)) {\n fs.mkdirSync(fontDir, { recursive: true });\n }\n\n console.log(\"📦 Installing Powerline Fonts...\");\n console.log(\"Downloading from https://github.com/powerline/fonts\");\n\n const tempDir = path.join(os.tmpdir(), \"powerline-fonts\");\n\n try {\n if (fs.existsSync(tempDir)) {\n fs.rmSync(tempDir, { recursive: true, force: true });\n }\n\n console.log(\"Cloning powerline fonts repository...\");\n execSync(\n \"git clone --depth=1 https://github.com/powerline/fonts.git powerline-fonts\",\n {\n stdio: \"inherit\",\n cwd: os.tmpdir(),\n }\n );\n\n console.log(\"Installing fonts...\");\n const installScript = path.join(tempDir, \"install.sh\");\n\n if (fs.existsSync(installScript)) {\n fs.chmodSync(installScript, 0o755);\n execSync(\"./install.sh\", { stdio: \"inherit\", cwd: tempDir });\n } else {\n throw new Error(\n \"Install script not found in powerline fonts repository\"\n );\n }\n\n console.log(\"✅ Powerline fonts installation complete!\");\n console.log(\n \"Please restart your terminal and set your terminal font to a powerline font.\"\n );\n console.log(\n \"Popular choices: Source Code Pro Powerline, DejaVu Sans Mono Powerline, Ubuntu Mono Powerline\"\n );\n } finally {\n if (fs.existsSync(tempDir)) {\n fs.rmSync(tempDir, { recursive: true, force: true });\n }\n }\n } catch (error) {\n console.error(\n \"Error installing fonts:\",\n error instanceof Error ? error.message : String(error)\n );\n console.log(\n \"💡 You can manually install fonts from: https://github.com/powerline/fonts\"\n );\n }\n}\n\nasync function main(): Promise<void> {\n try {\n const showHelp =\n process.argv.includes(\"--help\") || process.argv.includes(\"-h\");\n const installFontsFlag = process.argv.includes(\"--install-fonts\");\n\n if (installFontsFlag) {\n await installFonts();\n process.exit(0);\n }\n\n if (showHelp) {\n console.log(`\nclaude-powerline - Beautiful powerline statusline for Claude Code\n\nUsage: claude-powerline [options]\n\nStandalone Commands:\n --install-fonts Install powerline fonts to system\n -h, --help Show this help\n\nDebugging:\n CLAUDE_POWERLINE_DEBUG=1 Enable debug logging for troubleshooting\n\nClaude Code Options (for settings.json):\n --theme=THEME Set theme: dark, light, nord, tokyo-night, rose-pine, custom\n --style=STYLE Set separator style: minimal, powerline\n --usage=TYPE Usage display: cost, tokens, both, breakdown\n --session-budget=AMOUNT Set session budget for percentage tracking\n --daily-budget=AMOUNT Set daily budget for percentage tracking\n --config=PATH Use custom config file path\n\nConfiguration:\n Config files are loaded in this order (highest priority first):\n 1. CLI arguments (--theme, --style, --usage, --config)\n 2. Environment variables (CLAUDE_POWERLINE_THEME, CLAUDE_POWERLINE_STYLE, CLAUDE_POWERLINE_USAGE_TYPE, CLAUDE_POWERLINE_CONFIG)\n 3. ./.claude-powerline.json (project)\n 4. ~/.claude/claude-powerline.json (user)\n 5. ~/.config/claude-powerline/config.json (XDG)\n\nCreating a config file:\n Copy example from: https://github.com/Owloops/claude-powerline/blob/main/.claude-powerline.json\n\nUsage in Claude Code settings.json:\n{\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"claude-powerline\",\n \"padding\": 0\n }\n}\n`);\n process.exit(0);\n }\n\n if (process.stdin.isTTY === true) {\n console.error(`Error: This tool requires input from Claude Code\n\nclaude-powerline is designed to be used as a Claude Code statusLine command.\nIt reads hook data from stdin and outputs formatted statusline.\n\nAdd to ~/.claude/settings.json:\n{\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"claude-powerline --style=powerline\"\n }\n}\n\nRun with --help for more options.\n\nTo test output manually:\necho '{\"session_id\":\"test-session\",\"workspace\":{\"project_dir\":\"/path/to/project\"},\"model\":{\"id\":\"claude-3-5-sonnet\",\"display_name\":\"Claude\"}}' | claude-powerline --style=powerline`);\n process.exit(1);\n }\n\n debug(`Working directory: ${process.cwd()}`);\n debug(`Process args:`, process.argv);\n\n const hookData = (await json(process.stdin)) as ClaudeHookData;\n debug(`Received hook data:`, JSON.stringify(hookData, null, 2));\n\n if (!hookData) {\n console.error(\"Error: No input provided\");\n console.log(`\nclaude-powerline - Beautiful powerline statusline for Claude Code\n\nUsage: claude-powerline [options]\n\nOptions:\n --theme=THEME Set theme: dark, light, nord, tokyo-night, rose-pine, custom\n --style=STYLE Set separator style: minimal, powerline\n --usage=TYPE Usage display: cost, tokens, both, breakdown\n --session-budget=AMOUNT Set session budget for percentage tracking\n --daily-budget=AMOUNT Set daily budget for percentage tracking\n --config=PATH Use custom config file path\n --install-fonts Install powerline fonts to system\n -h, --help Show this help\n\nSee example config at: https://github.com/Owloops/claude-powerline/blob/main/.claude-powerline.json\n`);\n process.exit(1);\n }\n\n const projectDir = hookData.workspace?.project_dir;\n const config = loadConfigFromCLI(process.argv, projectDir);\n const renderer = new PowerlineRenderer(config);\n const statusline = await renderer.generateStatusline(hookData);\n\n console.log(statusline);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\"Error generating statusline:\", errorMessage);\n process.exit(1);\n }\n}\n\nmain();\n","export function hexToAnsi(hex: string, isBackground: boolean): string {\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return `\\x1b[${isBackground ? \"48\" : \"38\"};2;${r};${g};${b}m`;\n}\n\nexport function extractBgToFg(ansiCode: string): string {\n const match = ansiCode.match(/48;2;(\\d+);(\\d+);(\\d+)/);\n if (match) {\n return `\\x1b[38;2;${match[1]};${match[2]};${match[3]}m`;\n }\n return ansiCode.replace(\"48\", \"38\");\n}\n","import type { ColorTheme } from \"./index\";\n\nexport const darkTheme: ColorTheme = {\n directory: { bg: \"#8b4513\", fg: \"#ffffff\" },\n git: { bg: \"#404040\", fg: \"#ffffff\" },\n model: { bg: \"#2d2d2d\", fg: \"#ffffff\" },\n session: { bg: \"#202020\", fg: \"#00ffff\" },\n tmux: { bg: \"#2f4f2f\", fg: \"#90ee90\" },\n context: { bg: \"#4a5568\", fg: \"#cbd5e0\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const lightTheme: ColorTheme = {\n directory: { bg: \"#ff6b47\", fg: \"#ffffff\" },\n git: { bg: \"#4fb3d9\", fg: \"#ffffff\" },\n model: { bg: \"#87ceeb\", fg: \"#000000\" },\n session: { bg: \"#da70d6\", fg: \"#ffffff\" },\n tmux: { bg: \"#32cd32\", fg: \"#ffffff\" },\n context: { bg: \"#718096\", fg: \"#ffffff\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const nordTheme: ColorTheme = {\n directory: { bg: \"#434c5e\", fg: \"#d8dee9\" },\n git: { bg: \"#3b4252\", fg: \"#a3be8c\" },\n model: { bg: \"#4c566a\", fg: \"#81a1c1\" },\n session: { bg: \"#2e3440\", fg: \"#88c0d0\" },\n tmux: { bg: \"#2e3440\", fg: \"#8fbcbb\" },\n context: { bg: \"#5e81ac\", fg: \"#eceff4\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const tokyoNightTheme: ColorTheme = {\n directory: { bg: \"#2f334d\", fg: \"#82aaff\" },\n git: { bg: \"#1e2030\", fg: \"#c3e88d\" },\n model: { bg: \"#191b29\", fg: \"#fca7ea\" },\n session: { bg: \"#222436\", fg: \"#86e1fc\" },\n tmux: { bg: \"#191b29\", fg: \"#4fd6be\" },\n context: { bg: \"#414868\", fg: \"#c0caf5\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const rosePineTheme: ColorTheme = {\n directory: { bg: \"#26233a\", fg: \"#c4a7e7\" },\n git: { bg: \"#1f1d2e\", fg: \"#9ccfd8\" },\n model: { bg: \"#191724\", fg: \"#ebbcba\" },\n session: { bg: \"#26233a\", fg: \"#f6c177\" },\n tmux: { bg: \"#26233a\", fg: \"#908caa\" },\n context: { bg: \"#393552\", fg: \"#e0def4\" },\n};\n","import { darkTheme } from \"./dark\";\nimport { lightTheme } from \"./light\";\nimport { nordTheme } from \"./nord\";\nimport { tokyoNightTheme } from \"./tokyo-night\";\nimport { rosePineTheme } from \"./rose-pine\";\n\nexport interface SegmentColor {\n bg: string;\n fg: string;\n}\n\nexport interface ColorTheme {\n directory: SegmentColor;\n git: SegmentColor;\n model: SegmentColor;\n session: SegmentColor;\n tmux: SegmentColor;\n context: SegmentColor;\n}\n\nexport interface PowerlineColors {\n reset: string;\n modeBg: string;\n modeFg: string;\n gitBg: string;\n gitFg: string;\n modelBg: string;\n modelFg: string;\n sessionBg: string;\n sessionFg: string;\n tmuxBg: string;\n tmuxFg: string;\n contextBg: string;\n contextFg: string;\n}\n\nexport const BUILT_IN_THEMES: Record<string, ColorTheme> = {\n dark: darkTheme,\n light: lightTheme,\n nord: nordTheme,\n \"tokyo-night\": tokyoNightTheme,\n \"rose-pine\": rosePineTheme,\n};\n\nexport function getTheme(themeName: string): ColorTheme | null {\n return BUILT_IN_THEMES[themeName] || null;\n}\n\nexport { darkTheme, lightTheme, nordTheme, tokyoNightTheme, rosePineTheme };\n","import { execSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { debug } from \"../utils/logger\";\n\nexport interface GitInfo {\n branch: string;\n status: \"clean\" | \"dirty\" | \"conflicts\";\n ahead: number;\n behind: number;\n sha?: string;\n}\n\nexport class GitService {\n private isGitRepo(workingDir: string): boolean {\n try {\n return fs.existsSync(path.join(workingDir, \".git\"));\n } catch {\n return false;\n }\n }\n\n getGitInfo(workingDir: string, showSha = false): GitInfo | null {\n if (!this.isGitRepo(workingDir)) {\n return {\n branch: \"detached\",\n status: \"clean\",\n ahead: 0,\n behind: 0,\n sha: undefined,\n };\n }\n\n try {\n const branch = this.getBranch(workingDir);\n const status = this.getStatus(workingDir);\n const { ahead, behind } = this.getAheadBehind(workingDir);\n const sha = showSha ? this.getSha(workingDir) || undefined : undefined;\n\n return {\n branch: branch || \"detached\",\n status,\n ahead,\n behind,\n sha,\n };\n } catch {\n return null;\n }\n }\n\n private getBranch(workingDir: string): string | null {\n try {\n return (\n execSync(\"git branch --show-current\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim() || null\n );\n } catch (error) {\n debug(`Git branch command failed in ${workingDir}:`, error);\n return null;\n }\n }\n\n private getStatus(workingDir: string): \"clean\" | \"dirty\" | \"conflicts\" {\n try {\n const gitStatus = execSync(\"git status --porcelain\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n if (!gitStatus) return \"clean\";\n\n if (\n gitStatus.includes(\"UU\") ||\n gitStatus.includes(\"AA\") ||\n gitStatus.includes(\"DD\")\n ) {\n return \"conflicts\";\n }\n\n return \"dirty\";\n } catch (error) {\n debug(`Git status command failed in ${workingDir}:`, error);\n return \"clean\";\n }\n }\n\n private getAheadBehind(workingDir: string): {\n ahead: number;\n behind: number;\n } {\n try {\n const aheadResult = execSync(\"git rev-list --count @{u}..HEAD\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n const behindResult = execSync(\"git rev-list --count HEAD..@{u}\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n return {\n ahead: parseInt(aheadResult) || 0,\n behind: parseInt(behindResult) || 0,\n };\n } catch (error) {\n debug(`Git ahead/behind command failed in ${workingDir}:`, error);\n return { ahead: 0, behind: 0 };\n }\n }\n\n private getSha(workingDir: string): string | null {\n try {\n const sha = execSync(\"git rev-parse --short=7 HEAD\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n return sha || null;\n } catch {\n return null;\n }\n }\n}","const debug = (message: string, ...args: any[]): void => {\n if (process.env.CLAUDE_POWERLINE_DEBUG) {\n console.error(`[DEBUG] ${message}`, ...args);\n }\n};\n\nexport { debug };\n","import { execSync } from \"node:child_process\";\nimport { debug } from \"../utils/logger\";\n\nexport class TmuxService {\n getSessionId(): string | null {\n try {\n if (!process.env.TMUX_PANE) {\n debug(`TMUX_PANE not set, not in tmux session`);\n return null;\n }\n\n debug(`Getting tmux session ID, TMUX_PANE: ${process.env.TMUX_PANE}`);\n\n const sessionId = execSync(\"tmux display-message -p '#S'\", {\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n debug(`Tmux session ID: ${sessionId || \"empty\"}`);\n\n return sessionId || null;\n } catch (error) {\n debug(`Error getting tmux session ID:`, error);\n return null;\n }\n }\n\n isInTmux(): boolean {\n return !!process.env.TMUX_PANE;\n }\n}","import { readFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { debug } from \"../utils/logger\";\nimport { PricingService } from \"./pricing\";\n\nexport interface SessionUsageEntry {\n timestamp: string;\n message: {\n usage: {\n input_tokens: number;\n output_tokens: number;\n cache_creation_input_tokens?: number;\n cache_read_input_tokens?: number;\n };\n };\n costUSD?: number;\n}\n\nexport interface SessionUsage {\n totalCost: number;\n entries: SessionUsageEntry[];\n}\n\nexport interface TokenBreakdown {\n input: number;\n output: number;\n cacheCreation: number;\n cacheRead: number;\n}\n\nexport interface SessionInfo {\n cost: number | null;\n tokens: number | null;\n tokenBreakdown: TokenBreakdown | null;\n}\n\nexport interface UsageInfo {\n session: SessionInfo;\n}\n\nexport class SessionProvider {\n private getClaudePaths(): string[] {\n const paths: string[] = [];\n \n const homeDir = homedir();\n const defaultPath = join(homeDir, \".claude\");\n \n if (existsSync(defaultPath)) {\n paths.push(defaultPath);\n }\n \n return paths;\n }\n\n private async findProjectPaths(claudePaths: string[]): Promise<string[]> {\n const projectPaths: string[] = [];\n \n for (const claudePath of claudePaths) {\n const projectsDir = join(claudePath, \"projects\");\n \n if (existsSync(projectsDir)) {\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const entries = await readdir(projectsDir, { withFileTypes: true });\n \n for (const entry of entries) {\n if (entry.isDirectory()) {\n const projectPath = join(projectsDir, entry.name);\n projectPaths.push(projectPath);\n }\n }\n } catch (error) {\n debug(`Failed to read projects directory ${projectsDir}:`, error);\n }\n }\n }\n \n return projectPaths;\n }\n\n private async findTranscriptFile(sessionId: string): Promise<string | null> {\n const claudePaths = this.getClaudePaths();\n const projectPaths = await this.findProjectPaths(claudePaths);\n \n for (const projectPath of projectPaths) {\n const transcriptPath = join(projectPath, `${sessionId}.jsonl`);\n if (existsSync(transcriptPath)) {\n return transcriptPath;\n }\n }\n \n return null;\n }\n\n async getSessionUsage(sessionId: string): Promise<SessionUsage | null> {\n try {\n const transcriptPath = await this.findTranscriptFile(sessionId);\n if (!transcriptPath) {\n debug(`No transcript found for session: ${sessionId}`);\n return null;\n }\n\n debug(`Found transcript at: ${transcriptPath}`);\n \n const content = await readFile(transcriptPath, 'utf-8');\n const lines = content.trim().split('\\n').filter(line => line.trim());\n \n if (lines.length === 0) {\n return { totalCost: 0, entries: [] };\n }\n\n const entries: SessionUsageEntry[] = [];\n let totalCost = 0;\n\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as Record<string, unknown>;\n \n if (entry.message && typeof entry.message === 'object') {\n const message = entry.message as Record<string, unknown>;\n if (message.usage && typeof message.usage === 'object') {\n const sessionEntry: SessionUsageEntry = {\n timestamp: (entry.timestamp as string) || new Date().toISOString(),\n message: {\n usage: message.usage as SessionUsageEntry['message']['usage']\n }\n };\n\n if (typeof entry.costUSD === 'number') {\n sessionEntry.costUSD = entry.costUSD;\n totalCost += entry.costUSD;\n } else {\n const cost = await PricingService.calculateCostForEntry(entry);\n sessionEntry.costUSD = cost;\n totalCost += cost;\n }\n\n entries.push(sessionEntry);\n }\n }\n } catch (parseError) {\n debug(`Failed to parse JSONL line: ${parseError}`);\n continue;\n }\n }\n\n debug(`Parsed ${entries.length} usage entries, total cost: $${totalCost.toFixed(4)}`);\n return { totalCost, entries };\n\n } catch (error) {\n debug(`Error reading session usage for ${sessionId}:`, error);\n return null;\n }\n }\n\n calculateTokenBreakdown(entries: SessionUsageEntry[]): TokenBreakdown {\n return entries.reduce(\n (breakdown, entry) => ({\n input: breakdown.input + (entry.message.usage.input_tokens || 0),\n output: breakdown.output + (entry.message.usage.output_tokens || 0),\n cacheCreation: breakdown.cacheCreation + (entry.message.usage.cache_creation_input_tokens || 0),\n cacheRead: breakdown.cacheRead + (entry.message.usage.cache_read_input_tokens || 0),\n }),\n { input: 0, output: 0, cacheCreation: 0, cacheRead: 0 }\n );\n }\n\n async getSessionInfo(sessionId: string): Promise<SessionInfo> {\n const sessionUsage = await this.getSessionUsage(sessionId);\n \n if (!sessionUsage || sessionUsage.entries.length === 0) {\n return { cost: null, tokens: null, tokenBreakdown: null };\n }\n\n const tokenBreakdown = this.calculateTokenBreakdown(sessionUsage.entries);\n const totalTokens = tokenBreakdown.input + tokenBreakdown.output + \n tokenBreakdown.cacheCreation + tokenBreakdown.cacheRead;\n\n return {\n cost: sessionUsage.totalCost,\n tokens: totalTokens,\n tokenBreakdown,\n };\n }\n}\n\nexport class UsageProvider {\n private sessionProvider = new SessionProvider();\n\n async getUsageInfo(sessionId: string): Promise<UsageInfo> {\n try {\n debug(`Starting usage info retrieval for session: ${sessionId}`);\n \n const sessionInfo = await this.sessionProvider.getSessionInfo(sessionId);\n \n return {\n session: sessionInfo,\n };\n } catch (error) {\n debug(`Error getting usage info for session ${sessionId}:`, error);\n return {\n session: { cost: null, tokens: null, tokenBreakdown: null },\n };\n }\n }\n}","import { debug } from \"../utils/logger\";\n\n\nexport interface ModelPricing {\n name: string;\n input: number;\n cache_write_5m: number;\n cache_write_1h: number;\n cache_read: number;\n output: number;\n}\nconst OFFLINE_PRICING_DATA: Record<string, ModelPricing> = {\n \"claude-3-haiku-20240307\": {\n name: \"Claude 3 Haiku\",\n input: 0.25,\n output: 1.25,\n cache_write_5m: 0.30,\n cache_write_1h: 0.50,\n cache_read: 0.03\n },\n \"claude-3-5-haiku-20241022\": {\n name: \"Claude 3.5 Haiku\",\n input: 0.80,\n output: 4.00,\n cache_write_5m: 1.00,\n cache_write_1h: 1.60,\n cache_read: 0.08\n },\n \"claude-3-5-haiku-latest\": {\n name: \"Claude 3.5 Haiku Latest\",\n input: 1.00,\n output: 5.00,\n cache_write_5m: 1.25,\n cache_write_1h: 2.00,\n cache_read: 0.10\n },\n \"claude-3-opus-latest\": {\n name: \"Claude 3 Opus Latest\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-3-opus-20240229\": {\n name: \"Claude 3 Opus\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-3-5-sonnet-latest\": {\n name: \"Claude 3.5 Sonnet Latest\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-5-sonnet-20240620\": {\n name: \"Claude 3.5 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-5-sonnet-20241022\": {\n name: \"Claude 3.5 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-opus-4-20250514\": {\n name: \"Claude Opus 4\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-opus-4-1\": {\n name: \"Claude Opus 4.1\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-opus-4-1-20250805\": {\n name: \"Claude Opus 4.1\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-sonnet-4-20250514\": {\n name: \"Claude Sonnet 4\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-4-opus-20250514\": {\n name: \"Claude 4 Opus\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-4-sonnet-20250514\": {\n name: \"Claude 4 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-7-sonnet-latest\": {\n name: \"Claude 3.7 Sonnet Latest\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-7-sonnet-20250219\": {\n name: \"Claude 3.7 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n }\n};\n\nexport class PricingService {\n private static memoryCache: Map<string, { data: Record<string, ModelPricing>; timestamp: number }> = new Map();\n private static readonly CACHE_TTL = 24 * 60 * 60 * 1000;\n private static readonly GITHUB_PRICING_URL = \"https://raw.githubusercontent.com/Owloops/claude-powerline/main/pricing.json\";\n\n private static getCacheFilePath(): string {\n const { homedir } = require('os');\n const { join } = require('path');\n const { mkdirSync } = require('fs');\n \n const cacheDir = join(homedir(), '.claude', 'cache');\n try {\n mkdirSync(cacheDir, { recursive: true });\n } catch {}\n \n return join(cacheDir, 'pricing.json');\n }\n\n private static loadDiskCache(): { data: Record<string, ModelPricing>; timestamp: number } | null {\n try {\n const { readFileSync } = require('fs');\n const cacheFile = this.getCacheFilePath();\n const content = readFileSync(cacheFile, 'utf-8');\n const cached = JSON.parse(content);\n \n if (cached && cached.data && cached.timestamp) {\n return cached;\n }\n } catch {}\n return null;\n }\n\n private static saveDiskCache(data: Record<string, ModelPricing>): void {\n try {\n const { writeFileSync } = require('fs');\n const cacheFile = this.getCacheFilePath();\n const cacheData = { data, timestamp: Date.now() };\n writeFileSync(cacheFile, JSON.stringify(cacheData));\n } catch (error) {\n debug('Failed to save pricing cache to disk:', error);\n }\n }\n\n static async getCurrentPricing(): Promise<Record<string, ModelPricing>> {\n const now = Date.now();\n\n const memCached = this.memoryCache.get('pricing');\n if (memCached && now - memCached.timestamp < this.CACHE_TTL) {\n debug(`Using memory cached pricing data for ${Object.keys(memCached.data).length} models`);\n return memCached.data;\n }\n\n const diskCached = this.loadDiskCache();\n if (diskCached && now - diskCached.timestamp < this.CACHE_TTL) {\n this.memoryCache.set('pricing', diskCached);\n debug(`Using disk cached pricing data for ${Object.keys(diskCached.data).length} models`);\n return diskCached.data;\n }\n\n try {\n const response = await globalThis.fetch(this.GITHUB_PRICING_URL, {\n headers: {\n 'User-Agent': 'claude-powerline',\n 'Cache-Control': 'no-cache'\n }\n });\n\n if (response.ok) {\n const data = await response.json();\n \n const dataObj = data as Record<string, unknown>;\n const meta = dataObj._meta as { updated?: string } | undefined;\n \n const pricingData: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(dataObj)) {\n if (key !== '_meta') {\n pricingData[key] = value;\n }\n }\n \n if (this.validatePricingData(pricingData)) {\n this.memoryCache.set('pricing', { data: pricingData, timestamp: now });\n this.saveDiskCache(pricingData);\n debug(`Fetched fresh pricing from GitHub for ${Object.keys(pricingData).length} models`);\n debug(`Pricing last updated: ${meta?.updated || 'unknown'}`);\n return pricingData;\n }\n }\n } catch (error) {\n debug('Failed to fetch pricing from GitHub, using fallback:', error);\n }\n\n if (diskCached) {\n this.memoryCache.set('pricing', diskCached);\n debug(`Using stale cached pricing data for ${Object.keys(diskCached.data).length} models`);\n return diskCached.data;\n }\n\n debug(`Using offline pricing data for ${Object.keys(OFFLINE_PRICING_DATA).length} models`);\n return OFFLINE_PRICING_DATA;\n }\n\n private static validatePricingData(data: unknown): data is Record<string, ModelPricing> {\n if (!data || typeof data !== 'object') return false;\n \n for (const [, value] of Object.entries(data)) {\n if (!value || typeof value !== 'object') return false;\n const pricing = value as Record<string, unknown>;\n \n if (typeof pricing.input !== 'number' || \n typeof pricing.output !== 'number' ||\n typeof pricing.cache_read !== 'number') {\n return false;\n }\n }\n \n return true;\n }\n\n static async getModelPricing(modelId: string): Promise<ModelPricing> {\n const allPricing = await this.getCurrentPricing();\n \n if (allPricing[modelId]) {\n return allPricing[modelId];\n }\n\n return this.fuzzyMatchModel(modelId, allPricing);\n }\n\n\n private static fuzzyMatchModel(modelId: string, allPricing: Record<string, ModelPricing>): ModelPricing {\n const lowerModelId = modelId.toLowerCase();\n \n for (const [key, pricing] of Object.entries(allPricing)) {\n if (key.toLowerCase() === lowerModelId) {\n return pricing;\n }\n }\n const patterns = [\n { pattern: ['opus-4-1', 'claude-opus-4-1'], fallback: 'claude-opus-4-1-20250805' },\n { pattern: ['opus-4', 'claude-opus-4'], fallback: 'claude-opus-4-20250514' },\n { pattern: ['sonnet-4', 'claude-sonnet-4'], fallback: 'claude-sonnet-4-20250514' },\n { pattern: ['sonnet-3.7', '3-7-sonnet'], fallback: 'claude-3-7-sonnet-20250219' },\n { pattern: ['3-5-sonnet', 'sonnet-3.5'], fallback: 'claude-3-5-sonnet-20241022' },\n { pattern: ['3-5-haiku', 'haiku-3.5'], fallback: 'claude-3-5-haiku-20241022' },\n { pattern: ['haiku', '3-haiku'], fallback: 'claude-3-haiku-20240307' },\n { pattern: ['opus'], fallback: 'claude-opus-4-20250514' },\n { pattern: ['sonnet'], fallback: 'claude-3-5-sonnet-20241022' },\n ];\n\n for (const { pattern, fallback } of patterns) {\n if (pattern.some(p => lowerModelId.includes(p))) {\n if (allPricing[fallback]) {\n return allPricing[fallback];\n }\n }\n }\n\n return allPricing['claude-3-5-sonnet-20241022'] || {\n name: `${modelId} (Unknown Model)`,\n input: 3.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30,\n output: 15.00\n };\n }\n\n static async calculateCostForEntry(entry: Record<string, unknown>): Promise<number> {\n const message = entry.message as Record<string, unknown> | undefined;\n const usage = message?.usage as Record<string, unknown> | undefined;\n if (!usage) return 0;\n\n const modelId = this.extractModelId(entry);\n const pricing = await this.getModelPricing(modelId);\n \n const inputTokens = (usage.input_tokens as number) || 0;\n const outputTokens = (usage.output_tokens as number) || 0;\n const cacheCreationTokens = (usage.cache_creation_input_tokens as number) || 0;\n const cacheReadTokens = (usage.cache_read_input_tokens as number) || 0;\n \n const inputCost = (inputTokens / 1_000_000) * pricing.input;\n const outputCost = (outputTokens / 1_000_000) * pricing.output;\n const cacheReadCost = (cacheReadTokens / 1_000_000) * pricing.cache_read;\n const cacheCreationCost = (cacheCreationTokens / 1_000_000) * pricing.cache_write_5m;\n \n return inputCost + outputCost + cacheCreationCost + cacheReadCost;\n }\n\n private static extractModelId(entry: Record<string, unknown>): string {\n if (entry.model && typeof entry.model === 'string') {\n return entry.model;\n }\n \n const message = entry.message as Record<string, unknown> | undefined;\n if (message?.model) {\n const model = message.model;\n if (typeof model === 'string') {\n return model;\n }\n const modelObj = model as Record<string, unknown>;\n return (modelObj.id as string) || 'claude-3-5-sonnet-20241022';\n }\n \n if (entry.model_id && typeof entry.model_id === 'string') {\n return entry.model_id;\n }\n \n return 'claude-3-5-sonnet-20241022';\n }\n}","import { readFileSync } from \"node:fs\";\nimport { debug } from \"../utils/logger\";\n\nexport interface ContextInfo {\n inputTokens: number;\n percentage: number;\n usablePercentage: number;\n contextLeftPercentage: number;\n maxTokens: number;\n usableTokens: number;\n}\n\ninterface ContextUsageThresholds {\n LOW: number;\n MEDIUM: number;\n}\n\ninterface TranscriptEntry {\n message?: {\n usage?: {\n input_tokens?: number;\n cache_read_input_tokens?: number;\n cache_creation_input_tokens?: number;\n };\n };\n isSidechain?: boolean;\n timestamp?: string;\n}\n\nexport class ContextProvider {\n private readonly thresholds: ContextUsageThresholds = {\n LOW: 50,\n MEDIUM: 80,\n };\n\n getContextUsageThresholds(): ContextUsageThresholds {\n return this.thresholds;\n }\n\n private getContextLimit(_modelId: string): number {\n return 200000;\n }\n\n calculateContextTokens(\n transcriptPath: string,\n modelId?: string\n ): ContextInfo | null {\n try {\n debug(`Calculating context tokens from transcript: ${transcriptPath}`);\n\n const content = readFileSync(transcriptPath, \"utf-8\");\n if (!content) {\n debug(\"Transcript file is empty\");\n return null;\n }\n\n const lines = content.trim().split(\"\\n\");\n if (lines.length === 0) {\n debug(\"No lines in transcript\");\n return null;\n }\n\n let mostRecentEntry: TranscriptEntry | null = null;\n let mostRecentTime = 0;\n\n for (const line of lines) {\n if (!line.trim()) continue;\n\n try {\n const entry: TranscriptEntry = JSON.parse(line);\n\n if (!entry.message?.usage?.input_tokens) continue;\n\n if (entry.isSidechain === true) continue;\n\n if (!entry.timestamp) continue;\n\n const entryTime = new Date(entry.timestamp).getTime();\n if (entryTime > mostRecentTime) {\n mostRecentTime = entryTime;\n mostRecentEntry = entry;\n }\n } catch {}\n }\n\n if (mostRecentEntry?.message?.usage) {\n const usage = mostRecentEntry.message.usage;\n const contextLength =\n (usage.input_tokens || 0) +\n (usage.cache_read_input_tokens || 0) +\n (usage.cache_creation_input_tokens || 0);\n\n const contextLimit = modelId ? this.getContextLimit(modelId) : 200000;\n\n debug(\n `Most recent main chain context: ${contextLength} tokens (limit: ${contextLimit})`\n );\n\n const percentage = Math.min(\n 100,\n Math.max(0, Math.round((contextLength / contextLimit) * 100))\n );\n\n const usableLimit = Math.round(contextLimit * 0.8);\n const usablePercentage = Math.min(\n 100,\n Math.max(0, Math.round((contextLength / usableLimit) * 100))\n );\n\n const contextLeftPercentage = Math.max(0, 100 - usablePercentage);\n\n return {\n inputTokens: contextLength,\n percentage,\n usablePercentage,\n contextLeftPercentage,\n maxTokens: contextLimit,\n usableTokens: usableLimit,\n };\n }\n\n debug(\"No main chain entries with usage data found\");\n return null;\n } catch (error) {\n debug(\n `Error reading transcript: ${error instanceof Error ? error.message : String(error)}`\n );\n return null;\n }\n }\n}","interface TokenBreakdown {\n input: number;\n output: number;\n cacheCreation: number;\n cacheRead: number;\n}\n\nexport function formatCost(cost: number | null): string {\n if (cost === null) return \"$0.00\";\n if (cost < 0.01) return \"<$0.01\";\n return `$${cost.toFixed(2)}`;\n}\n\nexport function formatTokens(tokens: number | null): string {\n if (tokens === null) return \"0 tokens\";\n if (tokens === 0) return \"0 tokens\";\n if (tokens >= 1_000_000) {\n return `${(tokens / 1_000_000).toFixed(1)}M tokens`;\n } else if (tokens >= 1_000) {\n return `${(tokens / 1_000).toFixed(1)}K tokens`;\n }\n return `${tokens} tokens`;\n}\n\nexport function formatTokenBreakdown(breakdown: TokenBreakdown | null): string {\n if (!breakdown) return \"0 tokens\";\n\n const parts: string[] = [];\n\n if (breakdown.input > 0) {\n parts.push(`${formatTokens(breakdown.input).replace(\" tokens\", \"\")}in`);\n }\n\n if (breakdown.output > 0) {\n parts.push(`${formatTokens(breakdown.output).replace(\" tokens\", \"\")}out`);\n }\n\n if (breakdown.cacheCreation > 0 || breakdown.cacheRead > 0) {\n const totalCached = breakdown.cacheCreation + breakdown.cacheRead;\n parts.push(`${formatTokens(totalCached).replace(\" tokens\", \"\")}cached`);\n }\n\n return parts.length > 0 ? parts.join(\" + \") : \"0 tokens\";\n}\n","export interface BudgetStatus {\n percentage: number | null;\n isWarning: boolean;\n displayText: string;\n}\n\nexport function calculateBudgetPercentage(\n cost: number,\n budget: number | undefined\n): number | null {\n if (!budget || budget <= 0 || cost < 0) return null;\n return Math.min(100, (cost / budget) * 100);\n}\n\nexport function getBudgetStatus(\n cost: number,\n budget: number | undefined,\n warningThreshold = 80\n): BudgetStatus {\n const percentage = calculateBudgetPercentage(cost, budget);\n\n if (percentage === null) {\n return {\n percentage: null,\n isWarning: false,\n displayText: \"\",\n };\n }\n\n const percentStr = `${percentage.toFixed(0)}%`;\n const isWarning = percentage >= warningThreshold;\n\n let displayText = \"\";\n if (isWarning) {\n displayText = ` !${percentStr}`;\n } else if (percentage >= 50) {\n displayText = ` +${percentStr}`;\n } else {\n displayText = ` ${percentStr}`;\n }\n\n return {\n percentage,\n isWarning,\n displayText,\n };\n}\n","import type { ClaudeHookData } from \"../index\";\nimport type { PowerlineColors } from \"../themes\";\nimport type { PowerlineConfig } from \"../config/loader\";\n\nexport interface SegmentConfig {\n enabled: boolean;\n}\n\nexport interface GitSegmentConfig extends SegmentConfig {\n showSha: boolean;\n}\n\nexport interface UsageSegmentConfig extends SegmentConfig {\n type: \"cost\" | \"tokens\" | \"both\" | \"breakdown\";\n}\n\nexport interface TmuxSegmentConfig extends SegmentConfig {}\n\nexport interface ContextSegmentConfig extends SegmentConfig {}\n\nexport type AnySegmentConfig =\n | SegmentConfig\n | GitSegmentConfig\n | UsageSegmentConfig\n | TmuxSegmentConfig\n | ContextSegmentConfig;\n\nimport {\n formatCost,\n formatTokens,\n formatTokenBreakdown,\n} from \"../utils/formatters\";\nimport { getBudgetStatus } from \"../utils/budget\";\nimport type { UsageInfo, TokenBreakdown, GitInfo, ContextInfo } from \".\";\n\nexport interface PowerlineSymbols {\n right: string;\n branch: string;\n model: string;\n git_clean: string;\n git_dirty: string;\n git_conflicts: string;\n git_ahead: string;\n git_behind: string;\n session_cost: string;\n context_time: string;\n}\n\nexport interface SegmentData {\n text: string;\n bgColor: string;\n fgColor: string;\n}\n\nexport class SegmentRenderer {\n constructor(\n private readonly config: PowerlineConfig,\n private readonly symbols: PowerlineSymbols\n ) {}\n\n renderDirectory(\n hookData: ClaudeHookData,\n colors: PowerlineColors\n ): SegmentData {\n const currentDir = hookData.workspace?.current_dir || hookData.cwd || \"/\";\n const projectDir = hookData.workspace?.project_dir;\n const dirName = this.getDisplayDirectoryName(currentDir, projectDir);\n\n return {\n text: dirName,\n bgColor: colors.modeBg,\n fgColor: colors.modeFg,\n };\n }\n\n renderGit(\n gitInfo: GitInfo,\n colors: PowerlineColors,\n showSha = false\n ): SegmentData | null {\n if (!gitInfo) return null;\n\n let gitStatusIcon = this.symbols.git_clean;\n if (gitInfo.status === \"conflicts\") {\n gitStatusIcon = this.symbols.git_conflicts;\n } else if (gitInfo.status === \"dirty\") {\n gitStatusIcon = this.symbols.git_dirty;\n }\n\n let text = `${this.symbols.branch} ${gitInfo.branch} ${gitStatusIcon}`;\n\n if (gitInfo.sha && showSha) {\n text += ` ${gitInfo.sha}`;\n }\n\n if (gitInfo.ahead > 0 && gitInfo.behind > 0) {\n text += ` ${this.symbols.git_ahead}${gitInfo.ahead}${this.symbols.git_behind}${gitInfo.behind}`;\n } else if (gitInfo.ahead > 0) {\n text += ` ${this.symbols.git_ahead}${gitInfo.ahead}`;\n } else if (gitInfo.behind > 0) {\n text += ` ${this.symbols.git_behind}${gitInfo.behind}`;\n }\n\n return {\n text,\n bgColor: colors.gitBg,\n fgColor: colors.gitFg,\n };\n }\n\n renderModel(hookData: ClaudeHookData, colors: PowerlineColors): SegmentData {\n const modelName = hookData.model?.display_name || \"Claude\";\n\n return {\n text: `${this.symbols.model} ${modelName}`,\n bgColor: colors.modelBg,\n fgColor: colors.modelFg,\n };\n }\n\n renderSession(\n usageInfo: UsageInfo,\n colors: PowerlineColors,\n type = \"cost\"\n ): SegmentData {\n const sessionBudget = this.config.budget?.session;\n const text = `${this.symbols.session_cost} ${this.formatUsageWithBudget(\n usageInfo.session.cost,\n usageInfo.session.tokens,\n usageInfo.session.tokenBreakdown,\n type,\n sessionBudget?.amount,\n sessionBudget?.warningThreshold || 80\n )}`;\n\n return {\n text,\n bgColor: colors.sessionBg,\n fgColor: colors.sessionFg,\n };\n }\n\n renderTmux(\n sessionId: string | null,\n colors: PowerlineColors\n ): SegmentData | null {\n if (!sessionId) {\n return {\n text: `tmux:none`,\n bgColor: colors.tmuxBg,\n fgColor: colors.tmuxFg,\n };\n }\n\n return {\n text: `tmux:${sessionId}`,\n bgColor: colors.tmuxBg,\n fgColor: colors.tmuxFg,\n };\n }\n\n renderContext(\n contextInfo: ContextInfo | null,\n colors: PowerlineColors\n ): SegmentData | null {\n if (!contextInfo) {\n return {\n text: `${this.symbols.context_time} 0 (100%)`,\n bgColor: colors.contextBg,\n fgColor: colors.contextFg,\n };\n }\n\n const tokenDisplay = contextInfo.inputTokens.toLocaleString();\n\n const contextLeft = `${contextInfo.contextLeftPercentage}%`;\n\n return {\n text: `${this.symbols.context_time} ${tokenDisplay} (${contextLeft})`,\n bgColor: colors.contextBg,\n fgColor: colors.contextFg,\n };\n }\n\n private getDisplayDirectoryName(\n currentDir: string,\n projectDir?: string\n ): string {\n if (projectDir && projectDir !== currentDir) {\n const projectName = projectDir.split(\"/\").pop() || \"project\";\n const currentDirName = currentDir.split(\"/\").pop() || \"root\";\n\n if (currentDir.includes(projectDir)) {\n return `${projectName}/${currentDirName}`;\n }\n\n return currentDirName;\n }\n\n return currentDir.split(\"/\").pop() || \"root\";\n }\n\n private formatUsageDisplay(\n cost: number | null,\n tokens: number | null,\n tokenBreakdown: TokenBreakdown | null,\n type: string\n ): string {\n switch (type) {\n case \"cost\":\n return formatCost(cost);\n case \"tokens\":\n return formatTokens(tokens);\n case \"both\":\n return `${formatCost(cost)} (${formatTokens(tokens)})`;\n case \"breakdown\":\n return formatTokenBreakdown(tokenBreakdown);\n default:\n return formatCost(cost);\n }\n }\n\n private formatUsageWithBudget(\n cost: number | null,\n tokens: number | null,\n tokenBreakdown: TokenBreakdown | null,\n type: string,\n budget: number | undefined,\n warningThreshold = 80\n ): string {\n const baseDisplay = this.formatUsageDisplay(\n cost,\n tokens,\n tokenBreakdown,\n type\n );\n\n if (budget && budget > 0 && cost !== null) {\n const budgetStatus = getBudgetStatus(cost, budget, warningThreshold);\n return baseDisplay + budgetStatus.displayText;\n }\n\n return baseDisplay;\n }\n}\n","import type { ClaudeHookData } from \"./index\";\nimport type { PowerlineColors } from \"./themes\";\nimport type { PowerlineConfig, LineConfig } from \"./config/loader\";\nimport { hexToAnsi, extractBgToFg } from \"./utils/colors\";\nimport { getTheme } from \"./themes\";\nimport {\n UsageProvider,\n UsageInfo,\n ContextProvider,\n ContextInfo,\n GitService,\n TmuxService,\n SegmentRenderer,\n PowerlineSymbols,\n AnySegmentConfig,\n GitSegmentConfig,\n UsageSegmentConfig,\n} from \"./segments\";\n\nexport class PowerlineRenderer {\n private readonly symbols: PowerlineSymbols;\n private readonly usageProvider: UsageProvider;\n private readonly contextProvider: ContextProvider;\n private readonly gitService: GitService;\n private readonly tmuxService: TmuxService;\n private readonly segmentRenderer: SegmentRenderer;\n\n constructor(private readonly config: PowerlineConfig) {\n this.symbols = this.initializeSymbols();\n this.usageProvider = new UsageProvider();\n this.contextProvider = new ContextProvider();\n this.gitService = new GitService();\n this.tmuxService = new TmuxService();\n this.segmentRenderer = new SegmentRenderer(config, this.symbols);\n }\n\n private needsUsageInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.session?.enabled\n );\n }\n\n private needsGitInfo(): boolean {\n return this.config.display.lines.some((line) => line.segments.git?.enabled);\n }\n\n private needsTmuxInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.tmux?.enabled\n );\n }\n\n private needsContextInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.context?.enabled\n );\n }\n\n async generateStatusline(hookData: ClaudeHookData): Promise<string> {\n const usageInfo = this.needsUsageInfo()\n ? await this.usageProvider.getUsageInfo(hookData.session_id)\n : null;\n\n const contextInfo = this.needsContextInfo()\n ? this.contextProvider.calculateContextTokens(\n hookData.transcript_path,\n hookData.model?.id\n )\n : null;\n\n const lines = this.config.display.lines\n .map((lineConfig) =>\n this.renderLine(lineConfig, hookData, usageInfo, contextInfo)\n )\n .filter((line) => line.length > 0);\n\n return lines.join(\"\\n\");\n }\n\n private renderLine(\n lineConfig: LineConfig,\n hookData: ClaudeHookData,\n usageInfo: UsageInfo | null,\n contextInfo: ContextInfo | null\n ): string {\n const colors = this.getThemeColors();\n const currentDir = hookData.workspace?.current_dir || hookData.cwd || \"/\";\n\n const segments = Object.entries(lineConfig.segments)\n .filter(\n ([_, config]: [string, AnySegmentConfig | undefined]) => config?.enabled\n )\n .map(([type, config]: [string, AnySegmentConfig]) => ({ type, config }));\n\n let line = colors.reset;\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (!segment) continue;\n\n const isLast = i === segments.length - 1;\n const nextSegment = !isLast ? segments[i + 1] : null;\n const nextBgColor = nextSegment\n ? this.getSegmentBgColor(nextSegment.type, colors)\n : \"\";\n\n const segmentData = this.renderSegment(\n segment,\n hookData,\n usageInfo,\n contextInfo,\n colors,\n currentDir\n );\n\n if (segmentData) {\n line += this.formatSegment(\n segmentData.bgColor,\n segmentData.fgColor,\n segmentData.text,\n isLast ? undefined : nextBgColor\n );\n }\n }\n\n return line;\n }\n\n private renderSegment(\n segment: { type: string; config: AnySegmentConfig },\n hookData: ClaudeHookData,\n usageInfo: UsageInfo | null,\n contextInfo: ContextInfo | null,\n colors: PowerlineColors,\n currentDir: string\n ) {\n switch (segment.type) {\n case \"directory\":\n return this.segmentRenderer.renderDirectory(hookData, colors);\n\n case \"git\":\n if (!this.needsGitInfo()) return null;\n const showSha = (segment.config as GitSegmentConfig)?.showSha || false;\n const gitInfo = this.gitService.getGitInfo(currentDir, showSha);\n return gitInfo\n ? this.segmentRenderer.renderGit(gitInfo, colors, showSha)\n : null;\n\n case \"model\":\n return this.segmentRenderer.renderModel(hookData, colors);\n\n case \"session\":\n if (!usageInfo) return null;\n const usageType =\n (segment.config as UsageSegmentConfig)?.type || \"cost\";\n return this.segmentRenderer.renderSession(usageInfo, colors, usageType);\n\n case \"tmux\":\n if (!this.needsTmuxInfo()) return null;\n const tmuxSessionId = this.tmuxService.getSessionId();\n return this.segmentRenderer.renderTmux(tmuxSessionId, colors);\n\n case \"context\":\n if (!this.needsContextInfo()) return null;\n return this.segmentRenderer.renderContext(contextInfo, colors);\n\n default:\n return null;\n }\n }\n\n private initializeSymbols(): PowerlineSymbols {\n const isMinimalStyle = this.config.display.style === \"minimal\";\n\n return {\n right: isMinimalStyle ? \"\" : \"\\uE0B0\",\n branch: \"⑂\",\n model: \"⚡\",\n git_clean: \"✓\",\n git_dirty: \"●\",\n git_conflicts: \"⚠\",\n git_ahead: \"↑\",\n git_behind: \"↓\",\n session_cost: \"⊡\",\n context_time: \"◷\",\n };\n }\n\n private getThemeColors(): PowerlineColors {\n const theme = this.config.theme;\n let colorTheme;\n\n if (theme === \"custom\") {\n colorTheme = this.config.colors?.custom;\n if (!colorTheme) {\n throw new Error(\n \"Custom theme selected but no colors provided in configuration\"\n );\n }\n } else {\n colorTheme = getTheme(theme);\n if (!colorTheme) {\n console.warn(\n `Built-in theme '${theme}' not found, falling back to 'dark' theme`\n );\n colorTheme = getTheme(\"dark\")!;\n }\n }\n\n return {\n reset: \"\\x1b[0m\",\n modeBg: hexToAnsi(colorTheme.directory.bg, true),\n modeFg: hexToAnsi(colorTheme.directory.fg, false),\n gitBg: hexToAnsi(colorTheme.git.bg, true),\n gitFg: hexToAnsi(colorTheme.git.fg, false),\n modelBg: hexToAnsi(colorTheme.model.bg, true),\n modelFg: hexToAnsi(colorTheme.model.fg, false),\n sessionBg: hexToAnsi(colorTheme.session.bg, true),\n sessionFg: hexToAnsi(colorTheme.session.fg, false),\n tmuxBg: hexToAnsi(colorTheme.tmux.bg, true),\n tmuxFg: hexToAnsi(colorTheme.tmux.fg, false),\n contextBg: hexToAnsi(colorTheme.context.bg, true),\n contextFg: hexToAnsi(colorTheme.context.fg, false),\n };\n }\n\n private getSegmentBgColor(\n segmentType: string,\n colors: PowerlineColors\n ): string {\n switch (segmentType) {\n case \"directory\":\n return colors.modeBg;\n case \"git\":\n return colors.gitBg;\n case \"model\":\n return colors.modelBg;\n case \"session\":\n return colors.sessionBg;\n case \"tmux\":\n return colors.tmuxBg;\n case \"context\":\n return colors.contextBg;\n default:\n return colors.modeBg;\n }\n }\n\n private formatSegment(\n bgColor: string,\n fgColor: string,\n text: string,\n nextBgColor?: string\n ): string {\n let output = `${bgColor}${fgColor} ${text} `;\n\n const reset = \"\\x1b[0m\";\n\n if (nextBgColor) {\n const arrowFgColor = extractBgToFg(bgColor);\n output += `${reset}${nextBgColor}${arrowFgColor}${this.symbols.right}`;\n } else {\n output += `${reset}${extractBgToFg(bgColor)}${this.symbols.right}${reset}`;\n }\n\n return output;\n }\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport type { ColorTheme } from \"../themes\";\nimport type {\n SegmentConfig,\n GitSegmentConfig,\n UsageSegmentConfig,\n TmuxSegmentConfig,\n ContextSegmentConfig,\n} from \"../segments/renderer\";\n\nexport interface LineConfig {\n segments: {\n directory?: SegmentConfig;\n git?: GitSegmentConfig;\n model?: SegmentConfig;\n session?: UsageSegmentConfig;\n tmux?: TmuxSegmentConfig;\n context?: ContextSegmentConfig;\n };\n}\n\nexport interface DisplayConfig {\n lines: LineConfig[];\n style?: \"minimal\" | \"powerline\";\n}\n\nexport interface BudgetItemConfig {\n amount?: number;\n warningThreshold?: number;\n}\n\nexport interface BudgetConfig {\n session?: BudgetItemConfig;\n}\n\nexport interface PowerlineConfig {\n theme: \"light\" | \"dark\" | \"nord\" | \"tokyo-night\" | \"rose-pine\" | \"custom\";\n display: DisplayConfig;\n colors?: {\n custom: ColorTheme;\n };\n budget?: BudgetConfig;\n usageType?: \"cost\" | \"tokens\" | \"both\" | \"breakdown\";\n}\n\nexport interface ConfigLoadOptions {\n configPath?: string;\n ignoreEnvVars?: boolean;\n cliOverrides?: Partial<PowerlineConfig>;\n projectDir?: string;\n}\n\nfunction deepMerge<T extends Record<string, any>>(\n target: T,\n source: Partial<T>\n): T {\n const result = { ...target };\n\n for (const key in source) {\n const sourceValue = source[key];\n if (sourceValue !== undefined) {\n if (\n typeof sourceValue === \"object\" &&\n sourceValue !== null &&\n !Array.isArray(sourceValue)\n ) {\n const targetValue = result[key] || {};\n result[key] = deepMerge(\n targetValue as Record<string, any>,\n sourceValue as Record<string, any>\n ) as T[Extract<keyof T, string>];\n } else if (Array.isArray(sourceValue) && sourceValue.length === 0) {\n const targetValue = result[key];\n if (!Array.isArray(targetValue) || targetValue.length > 0) {\n continue;\n } else {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n } else {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n }\n }\n\n return result;\n}\n\nfunction findConfigFile(\n customPath?: string,\n projectDir?: string\n): string | null {\n if (customPath) {\n return fs.existsSync(customPath) ? customPath : null;\n }\n\n const locations = [\n ...(projectDir ? [path.join(projectDir, \".claude-powerline.json\")] : []),\n path.join(process.cwd(), \".claude-powerline.json\"),\n path.join(os.homedir(), \".claude\", \"claude-powerline.json\"),\n path.join(os.homedir(), \".config\", \"claude-powerline\", \"config.json\"),\n ];\n\n return locations.find(fs.existsSync) || null;\n}\n\nfunction loadConfigFile(filePath: string): Partial<PowerlineConfig> {\n try {\n const content = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(content);\n } catch (error) {\n throw new Error(\n `Failed to load config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\nfunction loadEnvConfig(): Partial<PowerlineConfig> {\n const config: Partial<PowerlineConfig> = {};\n\n if (process.env.CLAUDE_POWERLINE_THEME) {\n config.theme = process.env.CLAUDE_POWERLINE_THEME as\n | \"light\"\n | \"dark\"\n | \"custom\";\n }\n\n if (process.env.CLAUDE_POWERLINE_STYLE) {\n if (!config.display) {\n config.display = { lines: [] };\n }\n const style = process.env.CLAUDE_POWERLINE_STYLE;\n if (style === \"minimal\" || style === \"powerline\") {\n config.display.style = style;\n } else {\n console.warn(\n `Invalid display style '${style}' from environment variable, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n }\n\n if (process.env.CLAUDE_POWERLINE_USAGE_TYPE) {\n const usageType = process.env.CLAUDE_POWERLINE_USAGE_TYPE as\n | \"cost\"\n | \"tokens\"\n | \"both\"\n | \"breakdown\";\n if ([\"cost\", \"tokens\", \"both\", \"breakdown\"].includes(usageType)) {\n config.usageType = usageType;\n }\n }\n\n return config;\n}\n\nfunction getConfigPathFromEnv(): string | undefined {\n return process.env.CLAUDE_POWERLINE_CONFIG;\n}\n\nfunction parseCLIOverrides(args: string[]): Partial<PowerlineConfig> {\n const config: Partial<PowerlineConfig> = {};\n\n const themeIndex = args.findIndex((arg) => arg.startsWith(\"--theme=\"));\n if (themeIndex !== -1) {\n const theme = args[themeIndex]?.split(\"=\")[1];\n if (theme) {\n config.theme = theme as \"light\" | \"dark\" | \"custom\";\n }\n }\n\n const styleIndex = args.findIndex((arg) => arg.startsWith(\"--style=\"));\n if (styleIndex !== -1) {\n const style = args[styleIndex]?.split(\"=\")[1];\n if (style) {\n if (!config.display) {\n config.display = { lines: [] };\n }\n if (style === \"minimal\" || style === \"powerline\") {\n config.display.style = style;\n } else {\n console.warn(\n `Invalid display style '${style}' from CLI argument, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n }\n }\n\n\n const sessionBudgetIndex = args.findIndex((arg) =>\n arg.startsWith(\"--session-budget=\")\n );\n if (sessionBudgetIndex !== -1) {\n const sessionBudget = parseFloat(\n args[sessionBudgetIndex]?.split(\"=\")[1] || \"\"\n );\n if (!isNaN(sessionBudget) && sessionBudget > 0) {\n config.budget = {\n ...config.budget,\n session: {\n ...DEFAULT_CONFIG.budget?.session,\n amount: sessionBudget,\n },\n };\n }\n }\n\n const usageIndex = args.findIndex((arg) => arg.startsWith(\"--usage=\"));\n if (usageIndex !== -1) {\n const usageType = args[usageIndex]?.split(\"=\")[1] as\n | \"cost\"\n | \"tokens\"\n | \"both\"\n | \"breakdown\";\n if (\n usageType &&\n [\"cost\", \"tokens\", \"both\", \"breakdown\"].includes(usageType)\n ) {\n config.usageType = usageType;\n }\n }\n\n return config;\n}\n\nexport function loadConfig(options: ConfigLoadOptions = {}): PowerlineConfig {\n const {\n configPath,\n ignoreEnvVars = false,\n cliOverrides = {},\n projectDir,\n } = options;\n\n let config: PowerlineConfig = JSON.parse(JSON.stringify(DEFAULT_CONFIG));\n\n const configFile = findConfigFile(configPath, projectDir);\n if (configFile) {\n try {\n const fileConfig = loadConfigFile(configFile);\n config = deepMerge(config, fileConfig);\n } catch (err) {\n console.warn(\n `Warning: ${err instanceof Error ? err.message : String(err)}`\n );\n }\n }\n\n if (\n config.display?.style &&\n config.display.style !== \"minimal\" &&\n config.display.style !== \"powerline\"\n ) {\n console.warn(\n `Invalid display style '${config.display.style}' in config file, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n\n if (!ignoreEnvVars) {\n const envConfig = loadEnvConfig();\n config = deepMerge(config, envConfig);\n }\n\n config = deepMerge(config, cliOverrides);\n\n if (config.usageType) {\n config.display.lines.forEach((line) => {\n if (line.segments.session) {\n line.segments.session.type = config.usageType!;\n }\n });\n delete config.usageType;\n }\n\n return config;\n}\n\nexport function loadConfigFromCLI(\n args: string[] = process.argv,\n projectDir?: string\n): PowerlineConfig {\n const configPathIndex = args.findIndex((arg) => arg.startsWith(\"--config=\"));\n const configPath =\n configPathIndex !== -1\n ? args[configPathIndex]?.split(\"=\")[1]\n : getConfigPathFromEnv();\n\n const cliOverrides = parseCLIOverrides(args);\n\n return loadConfig({ configPath, cliOverrides, projectDir });\n}\n\nexport function getConfigPath(\n customPath?: string,\n projectDir?: string\n): string | null {\n return findConfigFile(customPath, projectDir);\n}\n","import type { PowerlineConfig } from \"./loader\";\n\nexport const DEFAULT_CONFIG: PowerlineConfig = {\n theme: \"dark\",\n display: {\n style: \"minimal\",\n lines: [\n {\n segments: {\n directory: { enabled: true },\n git: {\n enabled: true,\n showSha: false,\n },\n model: { enabled: true },\n session: { enabled: true, type: \"tokens\" },\n tmux: { enabled: false },\n context: { enabled: true },\n },\n },\n ],\n },\n budget: {\n session: {\n warningThreshold: 80,\n },\n },\n};\n"],"mappings":";;;;;;;;;AAEA,OAAOA,cAAa;AACpB,OAAOC,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,YAAAC,iBAAgB;AACzB,OAAOC,SAAQ;AACf,SAAS,YAAY;;;ACPd,SAAS,UAAU,KAAa,cAA+B;AACpE,QAAM,IAAI,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AACtC,QAAM,IAAI,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AACtC,QAAM,IAAI,SAAS,IAAI,MA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AU;AACb,cAAQ,MAAM,0BAA0B;AACxC,cAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAgBjB;AACK,MAAAA,SAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,aAAa,SAAS,WAAW;AACvC,UAAM,SAAS,kBAAkBA,SAAQ,MAAM,UAAU;AACzD,UAAM,WAAW,IAAI,kBAAkB,MAAM;AAC7C,UAAM,aAAa,MAAM,SAAS,mBAAmB,QAAQ;AAE7D,YAAQ,IAAI,UAAU;AAAA,EACxB,SAAS,OAAO;AACd,UAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC1E,YAAQ,MAAM,gCAAgC,YAAY;AAC1D,IAAAA,SAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,KAAK;","names":["process","path","fs","execSync","os","execSync","execSync","homedir","join","readFileSync","fs","path","fs","path","os","path","fs","execSync","process"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/utils/colors.ts","../src/themes/dark.ts","../src/themes/light.ts","../src/themes/nord.ts","../src/themes/tokyo-night.ts","../src/themes/rose-pine.ts","../src/themes/index.ts","../src/segments/git.ts","../src/utils/logger.ts","../src/segments/tmux.ts","../src/segments/session.ts","../src/segments/pricing.ts","../src/segments/context.ts","../src/utils/formatters.ts","../src/utils/budget.ts","../src/segments/renderer.ts","../src/powerline.ts","../src/config/loader.ts","../src/config/defaults.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from \"node:process\";\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { execSync } from \"node:child_process\";\nimport os from \"node:os\";\nimport { json } from \"node:stream/consumers\";\nimport { PowerlineRenderer } from \"./powerline\";\nimport { loadConfigFromCLI } from \"./config/loader\";\nimport { debug } from \"./utils/logger\";\nexport interface ClaudeHookData {\n hook_event_name: string;\n session_id: string;\n transcript_path: string;\n cwd: string;\n model: {\n id: string;\n display_name: string;\n };\n workspace: {\n current_dir: string;\n project_dir: string;\n };\n}\n\nasync function installFonts(): Promise<void> {\n try {\n const platform = os.platform();\n let fontDir: string;\n\n if (platform === \"darwin\") {\n fontDir = path.join(os.homedir(), \"Library\", \"Fonts\");\n } else if (platform === \"linux\") {\n fontDir = path.join(os.homedir(), \".local\", \"share\", \"fonts\");\n } else if (platform === \"win32\") {\n fontDir = path.join(\n os.homedir(),\n \"AppData\",\n \"Local\",\n \"Microsoft\",\n \"Windows\",\n \"Fonts\"\n );\n } else {\n console.log(\"Unsupported platform for font installation\");\n return;\n }\n\n if (!fs.existsSync(fontDir)) {\n fs.mkdirSync(fontDir, { recursive: true });\n }\n\n console.log(\"📦 Installing Powerline Fonts...\");\n console.log(\"Downloading from https://github.com/powerline/fonts\");\n\n const tempDir = path.join(os.tmpdir(), \"powerline-fonts\");\n\n try {\n if (fs.existsSync(tempDir)) {\n fs.rmSync(tempDir, { recursive: true, force: true });\n }\n\n console.log(\"Cloning powerline fonts repository...\");\n execSync(\n \"git clone --depth=1 https://github.com/powerline/fonts.git powerline-fonts\",\n {\n stdio: \"inherit\",\n cwd: os.tmpdir(),\n }\n );\n\n console.log(\"Installing fonts...\");\n const installScript = path.join(tempDir, \"install.sh\");\n\n if (fs.existsSync(installScript)) {\n fs.chmodSync(installScript, 0o755);\n execSync(\"./install.sh\", { stdio: \"inherit\", cwd: tempDir });\n } else {\n throw new Error(\n \"Install script not found in powerline fonts repository\"\n );\n }\n\n console.log(\"✅ Powerline fonts installation complete!\");\n console.log(\n \"Please restart your terminal and set your terminal font to a powerline font.\"\n );\n console.log(\n \"Popular choices: Source Code Pro Powerline, DejaVu Sans Mono Powerline, Ubuntu Mono Powerline\"\n );\n } finally {\n if (fs.existsSync(tempDir)) {\n fs.rmSync(tempDir, { recursive: true, force: true });\n }\n }\n } catch (error) {\n console.error(\n \"Error installing fonts:\",\n error instanceof Error ? error.message : String(error)\n );\n console.log(\n \"💡 You can manually install fonts from: https://github.com/powerline/fonts\"\n );\n }\n}\n\nasync function main(): Promise<void> {\n try {\n const showHelp =\n process.argv.includes(\"--help\") || process.argv.includes(\"-h\");\n const installFontsFlag = process.argv.includes(\"--install-fonts\");\n\n if (installFontsFlag) {\n await installFonts();\n process.exit(0);\n }\n\n if (showHelp) {\n console.log(`\nclaude-powerline - Beautiful powerline statusline for Claude Code\n\nUsage: claude-powerline [options]\n\nStandalone Commands:\n --install-fonts Install powerline fonts to system\n -h, --help Show this help\n\nDebugging:\n CLAUDE_POWERLINE_DEBUG=1 Enable debug logging for troubleshooting\n\nClaude Code Options (for settings.json):\n --theme=THEME Set theme: dark, light, nord, tokyo-night, rose-pine, custom\n --style=STYLE Set separator style: minimal, powerline\n --usage=TYPE Usage display: cost, tokens, both, breakdown\n --session-budget=AMOUNT Set session budget for percentage tracking\n --config=PATH Use custom config file path\n\nConfiguration:\n Config files are loaded in this order (highest priority first):\n 1. CLI arguments (--theme, --style, --usage, --config)\n 2. Environment variables (CLAUDE_POWERLINE_THEME, CLAUDE_POWERLINE_STYLE, CLAUDE_POWERLINE_USAGE_TYPE, CLAUDE_POWERLINE_CONFIG)\n 3. ./.claude-powerline.json (project)\n 4. ~/.claude/claude-powerline.json (user)\n 5. ~/.config/claude-powerline/config.json (XDG)\n\nCreating a config file:\n Copy example from: https://github.com/Owloops/claude-powerline/blob/main/.claude-powerline.json\n\nUsage in Claude Code settings.json:\n{\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"claude-powerline\",\n \"padding\": 0\n }\n}\n`);\n process.exit(0);\n }\n\n if (process.stdin.isTTY === true) {\n console.error(`Error: This tool requires input from Claude Code\n\nclaude-powerline is designed to be used as a Claude Code statusLine command.\nIt reads hook data from stdin and outputs formatted statusline.\n\nAdd to ~/.claude/settings.json:\n{\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"claude-powerline --style=powerline\"\n }\n}\n\nRun with --help for more options.\n\nTo test output manually:\necho '{\"session_id\":\"test-session\",\"workspace\":{\"project_dir\":\"/path/to/project\"},\"model\":{\"id\":\"claude-3-5-sonnet\",\"display_name\":\"Claude\"}}' | claude-powerline --style=powerline`);\n process.exit(1);\n }\n\n debug(`Working directory: ${process.cwd()}`);\n debug(`Process args:`, process.argv);\n\n const hookData = (await json(process.stdin)) as ClaudeHookData;\n debug(`Received hook data:`, JSON.stringify(hookData, null, 2));\n\n if (!hookData) {\n console.error(\"Error: No input data received from stdin\");\n console.log(`\nclaude-powerline - Beautiful powerline statusline for Claude Code\n\nUsage: claude-powerline [options]\n\nOptions:\n --theme=THEME Set theme: dark, light, nord, tokyo-night, rose-pine, custom\n --style=STYLE Set separator style: minimal, powerline\n --usage=TYPE Usage display: cost, tokens, both, breakdown\n --session-budget=AMOUNT Set session budget for percentage tracking\n --config=PATH Use custom config file path\n --install-fonts Install powerline fonts to system\n -h, --help Show this help\n\nSee example config at: https://github.com/Owloops/claude-powerline/blob/main/.claude-powerline.json\n`);\n process.exit(1);\n }\n\n const projectDir = hookData.workspace?.project_dir;\n const config = loadConfigFromCLI(process.argv, projectDir);\n const renderer = new PowerlineRenderer(config);\n const statusline = await renderer.generateStatusline(hookData);\n\n console.log(statusline);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(\"Error generating statusline:\", errorMessage);\n process.exit(1);\n }\n}\n\nmain();\n","export function hexToAnsi(hex: string, isBackground: boolean): string {\n const r = parseInt(hex.slice(1, 3), 16);\n const g = parseInt(hex.slice(3, 5), 16);\n const b = parseInt(hex.slice(5, 7), 16);\n return `\\x1b[${isBackground ? \"48\" : \"38\"};2;${r};${g};${b}m`;\n}\n\nexport function extractBgToFg(ansiCode: string): string {\n const match = ansiCode.match(/48;2;(\\d+);(\\d+);(\\d+)/);\n if (match) {\n return `\\x1b[38;2;${match[1]};${match[2]};${match[3]}m`;\n }\n return ansiCode.replace(\"48\", \"38\");\n}\n","import type { ColorTheme } from \"./index\";\n\nexport const darkTheme: ColorTheme = {\n directory: { bg: \"#8b4513\", fg: \"#ffffff\" },\n git: { bg: \"#404040\", fg: \"#ffffff\" },\n model: { bg: \"#2d2d2d\", fg: \"#ffffff\" },\n session: { bg: \"#202020\", fg: \"#00ffff\" },\n tmux: { bg: \"#2f4f2f\", fg: \"#90ee90\" },\n context: { bg: \"#4a5568\", fg: \"#cbd5e0\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const lightTheme: ColorTheme = {\n directory: { bg: \"#ff6b47\", fg: \"#ffffff\" },\n git: { bg: \"#4fb3d9\", fg: \"#ffffff\" },\n model: { bg: \"#87ceeb\", fg: \"#000000\" },\n session: { bg: \"#da70d6\", fg: \"#ffffff\" },\n tmux: { bg: \"#32cd32\", fg: \"#ffffff\" },\n context: { bg: \"#718096\", fg: \"#ffffff\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const nordTheme: ColorTheme = {\n directory: { bg: \"#434c5e\", fg: \"#d8dee9\" },\n git: { bg: \"#3b4252\", fg: \"#a3be8c\" },\n model: { bg: \"#4c566a\", fg: \"#81a1c1\" },\n session: { bg: \"#2e3440\", fg: \"#88c0d0\" },\n tmux: { bg: \"#2e3440\", fg: \"#8fbcbb\" },\n context: { bg: \"#5e81ac\", fg: \"#eceff4\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const tokyoNightTheme: ColorTheme = {\n directory: { bg: \"#2f334d\", fg: \"#82aaff\" },\n git: { bg: \"#1e2030\", fg: \"#c3e88d\" },\n model: { bg: \"#191b29\", fg: \"#fca7ea\" },\n session: { bg: \"#222436\", fg: \"#86e1fc\" },\n tmux: { bg: \"#191b29\", fg: \"#4fd6be\" },\n context: { bg: \"#414868\", fg: \"#c0caf5\" },\n};\n","import type { ColorTheme } from \"./index\";\n\nexport const rosePineTheme: ColorTheme = {\n directory: { bg: \"#26233a\", fg: \"#c4a7e7\" },\n git: { bg: \"#1f1d2e\", fg: \"#9ccfd8\" },\n model: { bg: \"#191724\", fg: \"#ebbcba\" },\n session: { bg: \"#26233a\", fg: \"#f6c177\" },\n tmux: { bg: \"#26233a\", fg: \"#908caa\" },\n context: { bg: \"#393552\", fg: \"#e0def4\" },\n};\n","import { darkTheme } from \"./dark\";\nimport { lightTheme } from \"./light\";\nimport { nordTheme } from \"./nord\";\nimport { tokyoNightTheme } from \"./tokyo-night\";\nimport { rosePineTheme } from \"./rose-pine\";\n\nexport interface SegmentColor {\n bg: string;\n fg: string;\n}\n\nexport interface ColorTheme {\n directory: SegmentColor;\n git: SegmentColor;\n model: SegmentColor;\n session: SegmentColor;\n tmux: SegmentColor;\n context: SegmentColor;\n}\n\nexport interface PowerlineColors {\n reset: string;\n modeBg: string;\n modeFg: string;\n gitBg: string;\n gitFg: string;\n modelBg: string;\n modelFg: string;\n sessionBg: string;\n sessionFg: string;\n tmuxBg: string;\n tmuxFg: string;\n contextBg: string;\n contextFg: string;\n}\n\nexport const BUILT_IN_THEMES: Record<string, ColorTheme> = {\n dark: darkTheme,\n light: lightTheme,\n nord: nordTheme,\n \"tokyo-night\": tokyoNightTheme,\n \"rose-pine\": rosePineTheme,\n};\n\nexport function getTheme(themeName: string): ColorTheme | null {\n return BUILT_IN_THEMES[themeName] || null;\n}\n\nexport { darkTheme, lightTheme, nordTheme, tokyoNightTheme, rosePineTheme };\n","import { execSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { debug } from \"../utils/logger\";\n\nexport interface GitInfo {\n branch: string;\n status: \"clean\" | \"dirty\" | \"conflicts\";\n ahead: number;\n behind: number;\n sha?: string;\n}\n\nexport class GitService {\n private isGitRepo(workingDir: string): boolean {\n try {\n return fs.existsSync(path.join(workingDir, \".git\"));\n } catch {\n return false;\n }\n }\n\n getGitInfo(workingDir: string, showSha = false): GitInfo | null {\n if (!this.isGitRepo(workingDir)) {\n return {\n branch: \"detached\",\n status: \"clean\",\n ahead: 0,\n behind: 0,\n sha: undefined,\n };\n }\n\n try {\n const branch = this.getBranch(workingDir);\n const status = this.getStatus(workingDir);\n const { ahead, behind } = this.getAheadBehind(workingDir);\n const sha = showSha ? this.getSha(workingDir) || undefined : undefined;\n\n return {\n branch: branch || \"detached\",\n status,\n ahead,\n behind,\n sha,\n };\n } catch {\n return null;\n }\n }\n\n private getBranch(workingDir: string): string | null {\n try {\n return (\n execSync(\"git branch --show-current\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim() || null\n );\n } catch (error) {\n debug(`Git branch command failed in ${workingDir}:`, error);\n return null;\n }\n }\n\n private getStatus(workingDir: string): \"clean\" | \"dirty\" | \"conflicts\" {\n try {\n const gitStatus = execSync(\"git status --porcelain\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n if (!gitStatus) return \"clean\";\n\n if (\n gitStatus.includes(\"UU\") ||\n gitStatus.includes(\"AA\") ||\n gitStatus.includes(\"DD\")\n ) {\n return \"conflicts\";\n }\n\n return \"dirty\";\n } catch (error) {\n debug(`Git status command failed in ${workingDir}:`, error);\n return \"clean\";\n }\n }\n\n private getAheadBehind(workingDir: string): {\n ahead: number;\n behind: number;\n } {\n try {\n const aheadResult = execSync(\"git rev-list --count @{u}..HEAD\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n const behindResult = execSync(\"git rev-list --count HEAD..@{u}\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n return {\n ahead: parseInt(aheadResult) || 0,\n behind: parseInt(behindResult) || 0,\n };\n } catch (error) {\n debug(`Git ahead/behind command failed in ${workingDir}:`, error);\n return { ahead: 0, behind: 0 };\n }\n }\n\n private getSha(workingDir: string): string | null {\n try {\n const sha = execSync(\"git rev-parse --short=7 HEAD\", {\n cwd: workingDir,\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n return sha || null;\n } catch {\n return null;\n }\n }\n}","const debug = (message: string, ...args: any[]): void => {\n if (process.env.CLAUDE_POWERLINE_DEBUG) {\n console.error(`[DEBUG] ${message}`, ...args);\n }\n};\n\nexport { debug };\n","import { execSync } from \"node:child_process\";\nimport { debug } from \"../utils/logger\";\n\nexport class TmuxService {\n getSessionId(): string | null {\n try {\n if (!process.env.TMUX_PANE) {\n debug(`TMUX_PANE not set, not in tmux session`);\n return null;\n }\n\n debug(`Getting tmux session ID, TMUX_PANE: ${process.env.TMUX_PANE}`);\n\n const sessionId = execSync(\"tmux display-message -p '#S'\", {\n encoding: \"utf8\",\n timeout: 1000,\n }).trim();\n\n debug(`Tmux session ID: ${sessionId || \"empty\"}`);\n\n return sessionId || null;\n } catch (error) {\n debug(`Error getting tmux session ID:`, error);\n return null;\n }\n }\n\n isInTmux(): boolean {\n return !!process.env.TMUX_PANE;\n }\n}","import { readFile } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { debug } from \"../utils/logger\";\nimport { PricingService } from \"./pricing\";\n\nexport interface SessionUsageEntry {\n timestamp: string;\n message: {\n usage: {\n input_tokens: number;\n output_tokens: number;\n cache_creation_input_tokens?: number;\n cache_read_input_tokens?: number;\n };\n };\n costUSD?: number;\n}\n\nexport interface SessionUsage {\n totalCost: number;\n entries: SessionUsageEntry[];\n}\n\nexport interface TokenBreakdown {\n input: number;\n output: number;\n cacheCreation: number;\n cacheRead: number;\n}\n\nexport interface SessionInfo {\n cost: number | null;\n tokens: number | null;\n tokenBreakdown: TokenBreakdown | null;\n}\n\nexport interface UsageInfo {\n session: SessionInfo;\n}\n\nexport class SessionProvider {\n private getClaudePaths(): string[] {\n const paths: string[] = [];\n \n const homeDir = homedir();\n const defaultPath = join(homeDir, \".claude\");\n \n if (existsSync(defaultPath)) {\n paths.push(defaultPath);\n }\n \n return paths;\n }\n\n private async findProjectPaths(claudePaths: string[]): Promise<string[]> {\n const projectPaths: string[] = [];\n \n for (const claudePath of claudePaths) {\n const projectsDir = join(claudePath, \"projects\");\n \n if (existsSync(projectsDir)) {\n try {\n const { readdir } = await import(\"node:fs/promises\");\n const entries = await readdir(projectsDir, { withFileTypes: true });\n \n for (const entry of entries) {\n if (entry.isDirectory()) {\n const projectPath = join(projectsDir, entry.name);\n projectPaths.push(projectPath);\n }\n }\n } catch (error) {\n debug(`Failed to read projects directory ${projectsDir}:`, error);\n }\n }\n }\n \n return projectPaths;\n }\n\n private async findTranscriptFile(sessionId: string): Promise<string | null> {\n const claudePaths = this.getClaudePaths();\n const projectPaths = await this.findProjectPaths(claudePaths);\n \n for (const projectPath of projectPaths) {\n const transcriptPath = join(projectPath, `${sessionId}.jsonl`);\n if (existsSync(transcriptPath)) {\n return transcriptPath;\n }\n }\n \n return null;\n }\n\n async getSessionUsage(sessionId: string): Promise<SessionUsage | null> {\n try {\n const transcriptPath = await this.findTranscriptFile(sessionId);\n if (!transcriptPath) {\n debug(`No transcript found for session: ${sessionId}`);\n return null;\n }\n\n debug(`Found transcript at: ${transcriptPath}`);\n \n const content = await readFile(transcriptPath, 'utf-8');\n const lines = content.trim().split('\\n').filter(line => line.trim());\n \n if (lines.length === 0) {\n return { totalCost: 0, entries: [] };\n }\n\n const entries: SessionUsageEntry[] = [];\n let totalCost = 0;\n\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as Record<string, unknown>;\n \n if (entry.message && typeof entry.message === 'object') {\n const message = entry.message as Record<string, unknown>;\n if (message.usage && typeof message.usage === 'object') {\n const sessionEntry: SessionUsageEntry = {\n timestamp: (entry.timestamp as string) || new Date().toISOString(),\n message: {\n usage: message.usage as SessionUsageEntry['message']['usage']\n }\n };\n\n if (typeof entry.costUSD === 'number') {\n sessionEntry.costUSD = entry.costUSD;\n totalCost += entry.costUSD;\n } else {\n const cost = await PricingService.calculateCostForEntry(entry);\n sessionEntry.costUSD = cost;\n totalCost += cost;\n }\n\n entries.push(sessionEntry);\n }\n }\n } catch (parseError) {\n debug(`Failed to parse JSONL line: ${parseError}`);\n continue;\n }\n }\n\n debug(`Parsed ${entries.length} usage entries, total cost: $${totalCost.toFixed(4)}`);\n return { totalCost, entries };\n\n } catch (error) {\n debug(`Error reading session usage for ${sessionId}:`, error);\n return null;\n }\n }\n\n calculateTokenBreakdown(entries: SessionUsageEntry[]): TokenBreakdown {\n return entries.reduce(\n (breakdown, entry) => ({\n input: breakdown.input + (entry.message.usage.input_tokens || 0),\n output: breakdown.output + (entry.message.usage.output_tokens || 0),\n cacheCreation: breakdown.cacheCreation + (entry.message.usage.cache_creation_input_tokens || 0),\n cacheRead: breakdown.cacheRead + (entry.message.usage.cache_read_input_tokens || 0),\n }),\n { input: 0, output: 0, cacheCreation: 0, cacheRead: 0 }\n );\n }\n\n async getSessionInfo(sessionId: string): Promise<SessionInfo> {\n const sessionUsage = await this.getSessionUsage(sessionId);\n \n if (!sessionUsage || sessionUsage.entries.length === 0) {\n return { cost: null, tokens: null, tokenBreakdown: null };\n }\n\n const tokenBreakdown = this.calculateTokenBreakdown(sessionUsage.entries);\n const totalTokens = tokenBreakdown.input + tokenBreakdown.output + \n tokenBreakdown.cacheCreation + tokenBreakdown.cacheRead;\n\n return {\n cost: sessionUsage.totalCost,\n tokens: totalTokens,\n tokenBreakdown,\n };\n }\n}\n\nexport class UsageProvider {\n private sessionProvider = new SessionProvider();\n\n async getUsageInfo(sessionId: string): Promise<UsageInfo> {\n try {\n debug(`Starting usage info retrieval for session: ${sessionId}`);\n \n const sessionInfo = await this.sessionProvider.getSessionInfo(sessionId);\n \n return {\n session: sessionInfo,\n };\n } catch (error) {\n debug(`Error getting usage info for session ${sessionId}:`, error);\n return {\n session: { cost: null, tokens: null, tokenBreakdown: null },\n };\n }\n }\n}","import { debug } from \"../utils/logger\";\n\n\nexport interface ModelPricing {\n name: string;\n input: number;\n cache_write_5m: number;\n cache_write_1h: number;\n cache_read: number;\n output: number;\n}\nconst OFFLINE_PRICING_DATA: Record<string, ModelPricing> = {\n \"claude-3-haiku-20240307\": {\n name: \"Claude 3 Haiku\",\n input: 0.25,\n output: 1.25,\n cache_write_5m: 0.30,\n cache_write_1h: 0.50,\n cache_read: 0.03\n },\n \"claude-3-5-haiku-20241022\": {\n name: \"Claude 3.5 Haiku\",\n input: 0.80,\n output: 4.00,\n cache_write_5m: 1.00,\n cache_write_1h: 1.60,\n cache_read: 0.08\n },\n \"claude-3-5-haiku-latest\": {\n name: \"Claude 3.5 Haiku Latest\",\n input: 1.00,\n output: 5.00,\n cache_write_5m: 1.25,\n cache_write_1h: 2.00,\n cache_read: 0.10\n },\n \"claude-3-opus-latest\": {\n name: \"Claude 3 Opus Latest\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-3-opus-20240229\": {\n name: \"Claude 3 Opus\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-3-5-sonnet-latest\": {\n name: \"Claude 3.5 Sonnet Latest\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-5-sonnet-20240620\": {\n name: \"Claude 3.5 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-5-sonnet-20241022\": {\n name: \"Claude 3.5 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-opus-4-20250514\": {\n name: \"Claude Opus 4\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-opus-4-1\": {\n name: \"Claude Opus 4.1\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-opus-4-1-20250805\": {\n name: \"Claude Opus 4.1\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-sonnet-4-20250514\": {\n name: \"Claude Sonnet 4\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-4-opus-20250514\": {\n name: \"Claude 4 Opus\",\n input: 15.00,\n output: 75.00,\n cache_write_5m: 18.75,\n cache_write_1h: 30.00,\n cache_read: 1.50\n },\n \"claude-4-sonnet-20250514\": {\n name: \"Claude 4 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-7-sonnet-latest\": {\n name: \"Claude 3.7 Sonnet Latest\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n },\n \"claude-3-7-sonnet-20250219\": {\n name: \"Claude 3.7 Sonnet\",\n input: 3.00,\n output: 15.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30\n }\n};\n\nexport class PricingService {\n private static memoryCache: Map<string, { data: Record<string, ModelPricing>; timestamp: number }> = new Map();\n private static readonly CACHE_TTL = 24 * 60 * 60 * 1000;\n private static readonly GITHUB_PRICING_URL = \"https://raw.githubusercontent.com/Owloops/claude-powerline/main/pricing.json\";\n\n private static getCacheFilePath(): string {\n const { homedir } = require('os');\n const { join } = require('path');\n const { mkdirSync } = require('fs');\n \n const cacheDir = join(homedir(), '.claude', 'cache');\n try {\n mkdirSync(cacheDir, { recursive: true });\n } catch {}\n \n return join(cacheDir, 'pricing.json');\n }\n\n private static loadDiskCache(): { data: Record<string, ModelPricing>; timestamp: number } | null {\n try {\n const { readFileSync } = require('fs');\n const cacheFile = this.getCacheFilePath();\n const content = readFileSync(cacheFile, 'utf-8');\n const cached = JSON.parse(content);\n \n if (cached && cached.data && cached.timestamp) {\n return cached;\n }\n } catch {}\n return null;\n }\n\n private static saveDiskCache(data: Record<string, ModelPricing>): void {\n try {\n const { writeFileSync } = require('fs');\n const cacheFile = this.getCacheFilePath();\n const cacheData = { data, timestamp: Date.now() };\n writeFileSync(cacheFile, JSON.stringify(cacheData));\n } catch (error) {\n debug('Failed to save pricing cache to disk:', error);\n }\n }\n\n static async getCurrentPricing(): Promise<Record<string, ModelPricing>> {\n const now = Date.now();\n\n const memCached = this.memoryCache.get('pricing');\n if (memCached && now - memCached.timestamp < this.CACHE_TTL) {\n debug(`Using memory cached pricing data for ${Object.keys(memCached.data).length} models`);\n return memCached.data;\n }\n\n const diskCached = this.loadDiskCache();\n if (diskCached && now - diskCached.timestamp < this.CACHE_TTL) {\n this.memoryCache.set('pricing', diskCached);\n debug(`Using disk cached pricing data for ${Object.keys(diskCached.data).length} models`);\n return diskCached.data;\n }\n\n try {\n const response = await globalThis.fetch(this.GITHUB_PRICING_URL, {\n headers: {\n 'User-Agent': 'claude-powerline',\n 'Cache-Control': 'no-cache'\n }\n });\n\n if (response.ok) {\n const data = await response.json();\n \n const dataObj = data as Record<string, unknown>;\n const meta = dataObj._meta as { updated?: string } | undefined;\n \n const pricingData: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(dataObj)) {\n if (key !== '_meta') {\n pricingData[key] = value;\n }\n }\n \n if (this.validatePricingData(pricingData)) {\n this.memoryCache.set('pricing', { data: pricingData, timestamp: now });\n this.saveDiskCache(pricingData);\n debug(`Fetched fresh pricing from GitHub for ${Object.keys(pricingData).length} models`);\n debug(`Pricing last updated: ${meta?.updated || 'unknown'}`);\n return pricingData;\n }\n }\n } catch (error) {\n debug('Failed to fetch pricing from GitHub, using fallback:', error);\n }\n\n if (diskCached) {\n this.memoryCache.set('pricing', diskCached);\n debug(`Using stale cached pricing data for ${Object.keys(diskCached.data).length} models`);\n return diskCached.data;\n }\n\n debug(`Using offline pricing data for ${Object.keys(OFFLINE_PRICING_DATA).length} models`);\n return OFFLINE_PRICING_DATA;\n }\n\n private static validatePricingData(data: unknown): data is Record<string, ModelPricing> {\n if (!data || typeof data !== 'object') return false;\n \n for (const [, value] of Object.entries(data)) {\n if (!value || typeof value !== 'object') return false;\n const pricing = value as Record<string, unknown>;\n \n if (typeof pricing.input !== 'number' || \n typeof pricing.output !== 'number' ||\n typeof pricing.cache_read !== 'number') {\n return false;\n }\n }\n \n return true;\n }\n\n static async getModelPricing(modelId: string): Promise<ModelPricing> {\n const allPricing = await this.getCurrentPricing();\n \n if (allPricing[modelId]) {\n return allPricing[modelId];\n }\n\n return this.fuzzyMatchModel(modelId, allPricing);\n }\n\n\n private static fuzzyMatchModel(modelId: string, allPricing: Record<string, ModelPricing>): ModelPricing {\n const lowerModelId = modelId.toLowerCase();\n \n for (const [key, pricing] of Object.entries(allPricing)) {\n if (key.toLowerCase() === lowerModelId) {\n return pricing;\n }\n }\n const patterns = [\n { pattern: ['opus-4-1', 'claude-opus-4-1'], fallback: 'claude-opus-4-1-20250805' },\n { pattern: ['opus-4', 'claude-opus-4'], fallback: 'claude-opus-4-20250514' },\n { pattern: ['sonnet-4', 'claude-sonnet-4'], fallback: 'claude-sonnet-4-20250514' },\n { pattern: ['sonnet-3.7', '3-7-sonnet'], fallback: 'claude-3-7-sonnet-20250219' },\n { pattern: ['3-5-sonnet', 'sonnet-3.5'], fallback: 'claude-3-5-sonnet-20241022' },\n { pattern: ['3-5-haiku', 'haiku-3.5'], fallback: 'claude-3-5-haiku-20241022' },\n { pattern: ['haiku', '3-haiku'], fallback: 'claude-3-haiku-20240307' },\n { pattern: ['opus'], fallback: 'claude-opus-4-20250514' },\n { pattern: ['sonnet'], fallback: 'claude-3-5-sonnet-20241022' },\n ];\n\n for (const { pattern, fallback } of patterns) {\n if (pattern.some(p => lowerModelId.includes(p))) {\n if (allPricing[fallback]) {\n return allPricing[fallback];\n }\n }\n }\n\n return allPricing['claude-3-5-sonnet-20241022'] || {\n name: `${modelId} (Unknown Model)`,\n input: 3.00,\n cache_write_5m: 3.75,\n cache_write_1h: 6.00,\n cache_read: 0.30,\n output: 15.00\n };\n }\n\n static async calculateCostForEntry(entry: Record<string, unknown>): Promise<number> {\n const message = entry.message as Record<string, unknown> | undefined;\n const usage = message?.usage as Record<string, unknown> | undefined;\n if (!usage) return 0;\n\n const modelId = this.extractModelId(entry);\n const pricing = await this.getModelPricing(modelId);\n \n const inputTokens = (usage.input_tokens as number) || 0;\n const outputTokens = (usage.output_tokens as number) || 0;\n const cacheCreationTokens = (usage.cache_creation_input_tokens as number) || 0;\n const cacheReadTokens = (usage.cache_read_input_tokens as number) || 0;\n \n const inputCost = (inputTokens / 1_000_000) * pricing.input;\n const outputCost = (outputTokens / 1_000_000) * pricing.output;\n const cacheReadCost = (cacheReadTokens / 1_000_000) * pricing.cache_read;\n const cacheCreationCost = (cacheCreationTokens / 1_000_000) * pricing.cache_write_5m;\n \n return inputCost + outputCost + cacheCreationCost + cacheReadCost;\n }\n\n private static extractModelId(entry: Record<string, unknown>): string {\n if (entry.model && typeof entry.model === 'string') {\n return entry.model;\n }\n \n const message = entry.message as Record<string, unknown> | undefined;\n if (message?.model) {\n const model = message.model;\n if (typeof model === 'string') {\n return model;\n }\n const modelObj = model as Record<string, unknown>;\n return (modelObj.id as string) || 'claude-3-5-sonnet-20241022';\n }\n \n if (entry.model_id && typeof entry.model_id === 'string') {\n return entry.model_id;\n }\n \n return 'claude-3-5-sonnet-20241022';\n }\n}","import { readFileSync } from \"node:fs\";\nimport { debug } from \"../utils/logger\";\n\nexport interface ContextInfo {\n inputTokens: number;\n percentage: number;\n usablePercentage: number;\n contextLeftPercentage: number;\n maxTokens: number;\n usableTokens: number;\n}\n\ninterface ContextUsageThresholds {\n LOW: number;\n MEDIUM: number;\n}\n\ninterface TranscriptEntry {\n message?: {\n usage?: {\n input_tokens?: number;\n cache_read_input_tokens?: number;\n cache_creation_input_tokens?: number;\n };\n };\n isSidechain?: boolean;\n timestamp?: string;\n}\n\nexport class ContextProvider {\n private readonly thresholds: ContextUsageThresholds = {\n LOW: 50,\n MEDIUM: 80,\n };\n\n getContextUsageThresholds(): ContextUsageThresholds {\n return this.thresholds;\n }\n\n private getContextLimit(_modelId: string): number {\n return 200000;\n }\n\n calculateContextTokens(\n transcriptPath: string,\n modelId?: string\n ): ContextInfo | null {\n try {\n debug(`Calculating context tokens from transcript: ${transcriptPath}`);\n\n const content = readFileSync(transcriptPath, \"utf-8\");\n if (!content) {\n debug(\"Transcript file is empty\");\n return null;\n }\n\n const lines = content.trim().split(\"\\n\");\n if (lines.length === 0) {\n debug(\"No lines in transcript\");\n return null;\n }\n\n let mostRecentEntry: TranscriptEntry | null = null;\n let mostRecentTime = 0;\n\n for (const line of lines) {\n if (!line.trim()) continue;\n\n try {\n const entry: TranscriptEntry = JSON.parse(line);\n\n if (!entry.message?.usage?.input_tokens) continue;\n\n if (entry.isSidechain === true) continue;\n\n if (!entry.timestamp) continue;\n\n const entryTime = new Date(entry.timestamp).getTime();\n if (entryTime > mostRecentTime) {\n mostRecentTime = entryTime;\n mostRecentEntry = entry;\n }\n } catch {}\n }\n\n if (mostRecentEntry?.message?.usage) {\n const usage = mostRecentEntry.message.usage;\n const contextLength =\n (usage.input_tokens || 0) +\n (usage.cache_read_input_tokens || 0) +\n (usage.cache_creation_input_tokens || 0);\n\n const contextLimit = modelId ? this.getContextLimit(modelId) : 200000;\n\n debug(\n `Most recent main chain context: ${contextLength} tokens (limit: ${contextLimit})`\n );\n\n const percentage = Math.min(\n 100,\n Math.max(0, Math.round((contextLength / contextLimit) * 100))\n );\n\n const usableLimit = Math.round(contextLimit * 0.8);\n const usablePercentage = Math.min(\n 100,\n Math.max(0, Math.round((contextLength / usableLimit) * 100))\n );\n\n const contextLeftPercentage = Math.max(0, 100 - usablePercentage);\n\n return {\n inputTokens: contextLength,\n percentage,\n usablePercentage,\n contextLeftPercentage,\n maxTokens: contextLimit,\n usableTokens: usableLimit,\n };\n }\n\n debug(\"No main chain entries with usage data found\");\n return null;\n } catch (error) {\n debug(\n `Error reading transcript: ${error instanceof Error ? error.message : String(error)}`\n );\n return null;\n }\n }\n}","interface TokenBreakdown {\n input: number;\n output: number;\n cacheCreation: number;\n cacheRead: number;\n}\n\nexport function formatCost(cost: number | null): string {\n if (cost === null) return \"$0.00\";\n if (cost < 0.01) return \"<$0.01\";\n return `$${cost.toFixed(2)}`;\n}\n\nexport function formatTokens(tokens: number | null): string {\n if (tokens === null) return \"0 tokens\";\n if (tokens === 0) return \"0 tokens\";\n if (tokens >= 1_000_000) {\n return `${(tokens / 1_000_000).toFixed(1)}M tokens`;\n } else if (tokens >= 1_000) {\n return `${(tokens / 1_000).toFixed(1)}K tokens`;\n }\n return `${tokens} tokens`;\n}\n\nexport function formatTokenBreakdown(breakdown: TokenBreakdown | null): string {\n if (!breakdown) return \"0 tokens\";\n\n const parts: string[] = [];\n\n if (breakdown.input > 0) {\n parts.push(`${formatTokens(breakdown.input).replace(\" tokens\", \"\")}in`);\n }\n\n if (breakdown.output > 0) {\n parts.push(`${formatTokens(breakdown.output).replace(\" tokens\", \"\")}out`);\n }\n\n if (breakdown.cacheCreation > 0 || breakdown.cacheRead > 0) {\n const totalCached = breakdown.cacheCreation + breakdown.cacheRead;\n parts.push(`${formatTokens(totalCached).replace(\" tokens\", \"\")}cached`);\n }\n\n return parts.length > 0 ? parts.join(\" + \") : \"0 tokens\";\n}\n","export interface BudgetStatus {\n percentage: number | null;\n isWarning: boolean;\n displayText: string;\n}\n\nexport function calculateBudgetPercentage(\n cost: number,\n budget: number | undefined\n): number | null {\n if (!budget || budget <= 0 || cost < 0) return null;\n return Math.min(100, (cost / budget) * 100);\n}\n\nexport function getBudgetStatus(\n cost: number,\n budget: number | undefined,\n warningThreshold = 80\n): BudgetStatus {\n const percentage = calculateBudgetPercentage(cost, budget);\n\n if (percentage === null) {\n return {\n percentage: null,\n isWarning: false,\n displayText: \"\",\n };\n }\n\n const percentStr = `${percentage.toFixed(0)}%`;\n const isWarning = percentage >= warningThreshold;\n\n let displayText = \"\";\n if (isWarning) {\n displayText = ` !${percentStr}`;\n } else if (percentage >= 50) {\n displayText = ` +${percentStr}`;\n } else {\n displayText = ` ${percentStr}`;\n }\n\n return {\n percentage,\n isWarning,\n displayText,\n };\n}\n","import type { ClaudeHookData } from \"../index\";\nimport type { PowerlineColors } from \"../themes\";\nimport type { PowerlineConfig } from \"../config/loader\";\n\nexport interface SegmentConfig {\n enabled: boolean;\n}\n\nexport interface GitSegmentConfig extends SegmentConfig {\n showSha: boolean;\n}\n\nexport interface UsageSegmentConfig extends SegmentConfig {\n type: \"cost\" | \"tokens\" | \"both\" | \"breakdown\";\n}\n\nexport interface TmuxSegmentConfig extends SegmentConfig {}\n\nexport interface ContextSegmentConfig extends SegmentConfig {}\n\nexport type AnySegmentConfig =\n | SegmentConfig\n | GitSegmentConfig\n | UsageSegmentConfig\n | TmuxSegmentConfig\n | ContextSegmentConfig;\n\nimport {\n formatCost,\n formatTokens,\n formatTokenBreakdown,\n} from \"../utils/formatters\";\nimport { getBudgetStatus } from \"../utils/budget\";\nimport type { UsageInfo, TokenBreakdown, GitInfo, ContextInfo } from \".\";\n\nexport interface PowerlineSymbols {\n right: string;\n branch: string;\n model: string;\n git_clean: string;\n git_dirty: string;\n git_conflicts: string;\n git_ahead: string;\n git_behind: string;\n session_cost: string;\n context_time: string;\n}\n\nexport interface SegmentData {\n text: string;\n bgColor: string;\n fgColor: string;\n}\n\nexport class SegmentRenderer {\n constructor(\n private readonly config: PowerlineConfig,\n private readonly symbols: PowerlineSymbols\n ) {}\n\n renderDirectory(\n hookData: ClaudeHookData,\n colors: PowerlineColors\n ): SegmentData {\n const currentDir = hookData.workspace?.current_dir || hookData.cwd || \"/\";\n const projectDir = hookData.workspace?.project_dir;\n const dirName = this.getDisplayDirectoryName(currentDir, projectDir);\n\n return {\n text: dirName,\n bgColor: colors.modeBg,\n fgColor: colors.modeFg,\n };\n }\n\n renderGit(\n gitInfo: GitInfo,\n colors: PowerlineColors,\n showSha = false\n ): SegmentData | null {\n if (!gitInfo) return null;\n\n let gitStatusIcon = this.symbols.git_clean;\n if (gitInfo.status === \"conflicts\") {\n gitStatusIcon = this.symbols.git_conflicts;\n } else if (gitInfo.status === \"dirty\") {\n gitStatusIcon = this.symbols.git_dirty;\n }\n\n let text = `${this.symbols.branch} ${gitInfo.branch} ${gitStatusIcon}`;\n\n if (gitInfo.sha && showSha) {\n text += ` ${gitInfo.sha}`;\n }\n\n if (gitInfo.ahead > 0 && gitInfo.behind > 0) {\n text += ` ${this.symbols.git_ahead}${gitInfo.ahead}${this.symbols.git_behind}${gitInfo.behind}`;\n } else if (gitInfo.ahead > 0) {\n text += ` ${this.symbols.git_ahead}${gitInfo.ahead}`;\n } else if (gitInfo.behind > 0) {\n text += ` ${this.symbols.git_behind}${gitInfo.behind}`;\n }\n\n return {\n text,\n bgColor: colors.gitBg,\n fgColor: colors.gitFg,\n };\n }\n\n renderModel(hookData: ClaudeHookData, colors: PowerlineColors): SegmentData {\n const modelName = hookData.model?.display_name || \"Claude\";\n\n return {\n text: `${this.symbols.model} ${modelName}`,\n bgColor: colors.modelBg,\n fgColor: colors.modelFg,\n };\n }\n\n renderSession(\n usageInfo: UsageInfo,\n colors: PowerlineColors,\n type = \"cost\"\n ): SegmentData {\n const sessionBudget = this.config.budget?.session;\n const text = `${this.symbols.session_cost} ${this.formatUsageWithBudget(\n usageInfo.session.cost,\n usageInfo.session.tokens,\n usageInfo.session.tokenBreakdown,\n type,\n sessionBudget?.amount,\n sessionBudget?.warningThreshold || 80\n )}`;\n\n return {\n text,\n bgColor: colors.sessionBg,\n fgColor: colors.sessionFg,\n };\n }\n\n renderTmux(\n sessionId: string | null,\n colors: PowerlineColors\n ): SegmentData | null {\n if (!sessionId) {\n return {\n text: `tmux:none`,\n bgColor: colors.tmuxBg,\n fgColor: colors.tmuxFg,\n };\n }\n\n return {\n text: `tmux:${sessionId}`,\n bgColor: colors.tmuxBg,\n fgColor: colors.tmuxFg,\n };\n }\n\n renderContext(\n contextInfo: ContextInfo | null,\n colors: PowerlineColors\n ): SegmentData | null {\n if (!contextInfo) {\n return {\n text: `${this.symbols.context_time} 0 (100%)`,\n bgColor: colors.contextBg,\n fgColor: colors.contextFg,\n };\n }\n\n const tokenDisplay = contextInfo.inputTokens.toLocaleString();\n\n const contextLeft = `${contextInfo.contextLeftPercentage}%`;\n\n return {\n text: `${this.symbols.context_time} ${tokenDisplay} (${contextLeft})`,\n bgColor: colors.contextBg,\n fgColor: colors.contextFg,\n };\n }\n\n private getDisplayDirectoryName(\n currentDir: string,\n projectDir?: string\n ): string {\n if (projectDir && projectDir !== currentDir) {\n const projectName = projectDir.split(\"/\").pop() || \"project\";\n const currentDirName = currentDir.split(\"/\").pop() || \"root\";\n\n if (currentDir.includes(projectDir)) {\n return `${projectName}/${currentDirName}`;\n }\n\n return currentDirName;\n }\n\n return currentDir.split(\"/\").pop() || \"root\";\n }\n\n private formatUsageDisplay(\n cost: number | null,\n tokens: number | null,\n tokenBreakdown: TokenBreakdown | null,\n type: string\n ): string {\n switch (type) {\n case \"cost\":\n return formatCost(cost);\n case \"tokens\":\n return formatTokens(tokens);\n case \"both\":\n return `${formatCost(cost)} (${formatTokens(tokens)})`;\n case \"breakdown\":\n return formatTokenBreakdown(tokenBreakdown);\n default:\n return formatCost(cost);\n }\n }\n\n private formatUsageWithBudget(\n cost: number | null,\n tokens: number | null,\n tokenBreakdown: TokenBreakdown | null,\n type: string,\n budget: number | undefined,\n warningThreshold = 80\n ): string {\n const baseDisplay = this.formatUsageDisplay(\n cost,\n tokens,\n tokenBreakdown,\n type\n );\n\n if (budget && budget > 0 && cost !== null) {\n const budgetStatus = getBudgetStatus(cost, budget, warningThreshold);\n return baseDisplay + budgetStatus.displayText;\n }\n\n return baseDisplay;\n }\n}\n","import type { ClaudeHookData } from \"./index\";\nimport type { PowerlineColors } from \"./themes\";\nimport type { PowerlineConfig, LineConfig } from \"./config/loader\";\nimport { hexToAnsi, extractBgToFg } from \"./utils/colors\";\nimport { getTheme } from \"./themes\";\nimport {\n UsageProvider,\n UsageInfo,\n ContextProvider,\n ContextInfo,\n GitService,\n TmuxService,\n SegmentRenderer,\n PowerlineSymbols,\n AnySegmentConfig,\n GitSegmentConfig,\n UsageSegmentConfig,\n} from \"./segments\";\n\nexport class PowerlineRenderer {\n private readonly symbols: PowerlineSymbols;\n private readonly usageProvider: UsageProvider;\n private readonly contextProvider: ContextProvider;\n private readonly gitService: GitService;\n private readonly tmuxService: TmuxService;\n private readonly segmentRenderer: SegmentRenderer;\n\n constructor(private readonly config: PowerlineConfig) {\n this.symbols = this.initializeSymbols();\n this.usageProvider = new UsageProvider();\n this.contextProvider = new ContextProvider();\n this.gitService = new GitService();\n this.tmuxService = new TmuxService();\n this.segmentRenderer = new SegmentRenderer(config, this.symbols);\n }\n\n private needsUsageInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.session?.enabled\n );\n }\n\n private needsGitInfo(): boolean {\n return this.config.display.lines.some((line) => line.segments.git?.enabled);\n }\n\n private needsTmuxInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.tmux?.enabled\n );\n }\n\n private needsContextInfo(): boolean {\n return this.config.display.lines.some(\n (line) => line.segments.context?.enabled\n );\n }\n\n async generateStatusline(hookData: ClaudeHookData): Promise<string> {\n const usageInfo = this.needsUsageInfo()\n ? await this.usageProvider.getUsageInfo(hookData.session_id)\n : null;\n\n const contextInfo = this.needsContextInfo()\n ? this.contextProvider.calculateContextTokens(\n hookData.transcript_path,\n hookData.model?.id\n )\n : null;\n\n const lines = this.config.display.lines\n .map((lineConfig) =>\n this.renderLine(lineConfig, hookData, usageInfo, contextInfo)\n )\n .filter((line) => line.length > 0);\n\n return lines.join(\"\\n\");\n }\n\n private renderLine(\n lineConfig: LineConfig,\n hookData: ClaudeHookData,\n usageInfo: UsageInfo | null,\n contextInfo: ContextInfo | null\n ): string {\n const colors = this.getThemeColors();\n const currentDir = hookData.workspace?.current_dir || hookData.cwd || \"/\";\n\n const segments = Object.entries(lineConfig.segments)\n .filter(\n ([_, config]: [string, AnySegmentConfig | undefined]) => config?.enabled\n )\n .map(([type, config]: [string, AnySegmentConfig]) => ({ type, config }));\n\n let line = colors.reset;\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (!segment) continue;\n\n const isLast = i === segments.length - 1;\n const nextSegment = !isLast ? segments[i + 1] : null;\n const nextBgColor = nextSegment\n ? this.getSegmentBgColor(nextSegment.type, colors)\n : \"\";\n\n const segmentData = this.renderSegment(\n segment,\n hookData,\n usageInfo,\n contextInfo,\n colors,\n currentDir\n );\n\n if (segmentData) {\n line += this.formatSegment(\n segmentData.bgColor,\n segmentData.fgColor,\n segmentData.text,\n isLast ? undefined : nextBgColor\n );\n }\n }\n\n return line;\n }\n\n private renderSegment(\n segment: { type: string; config: AnySegmentConfig },\n hookData: ClaudeHookData,\n usageInfo: UsageInfo | null,\n contextInfo: ContextInfo | null,\n colors: PowerlineColors,\n currentDir: string\n ) {\n switch (segment.type) {\n case \"directory\":\n return this.segmentRenderer.renderDirectory(hookData, colors);\n\n case \"git\":\n if (!this.needsGitInfo()) return null;\n const showSha = (segment.config as GitSegmentConfig)?.showSha || false;\n const gitInfo = this.gitService.getGitInfo(currentDir, showSha);\n return gitInfo\n ? this.segmentRenderer.renderGit(gitInfo, colors, showSha)\n : null;\n\n case \"model\":\n return this.segmentRenderer.renderModel(hookData, colors);\n\n case \"session\":\n if (!usageInfo) return null;\n const usageType =\n (segment.config as UsageSegmentConfig)?.type || \"cost\";\n return this.segmentRenderer.renderSession(usageInfo, colors, usageType);\n\n case \"tmux\":\n if (!this.needsTmuxInfo()) return null;\n const tmuxSessionId = this.tmuxService.getSessionId();\n return this.segmentRenderer.renderTmux(tmuxSessionId, colors);\n\n case \"context\":\n if (!this.needsContextInfo()) return null;\n return this.segmentRenderer.renderContext(contextInfo, colors);\n\n default:\n return null;\n }\n }\n\n private initializeSymbols(): PowerlineSymbols {\n const isMinimalStyle = this.config.display.style === \"minimal\";\n\n return {\n right: isMinimalStyle ? \"\" : \"\\uE0B0\",\n branch: \"⑂\",\n model: \"⚡\",\n git_clean: \"✓\",\n git_dirty: \"●\",\n git_conflicts: \"⚠\",\n git_ahead: \"↑\",\n git_behind: \"↓\",\n session_cost: \"⊡\",\n context_time: \"◷\",\n };\n }\n\n private getThemeColors(): PowerlineColors {\n const theme = this.config.theme;\n let colorTheme;\n\n if (theme === \"custom\") {\n colorTheme = this.config.colors?.custom;\n if (!colorTheme) {\n throw new Error(\n \"Custom theme selected but no colors provided in configuration\"\n );\n }\n } else {\n colorTheme = getTheme(theme);\n if (!colorTheme) {\n console.warn(\n `Built-in theme '${theme}' not found, falling back to 'dark' theme`\n );\n colorTheme = getTheme(\"dark\")!;\n }\n }\n\n return {\n reset: \"\\x1b[0m\",\n modeBg: hexToAnsi(colorTheme.directory.bg, true),\n modeFg: hexToAnsi(colorTheme.directory.fg, false),\n gitBg: hexToAnsi(colorTheme.git.bg, true),\n gitFg: hexToAnsi(colorTheme.git.fg, false),\n modelBg: hexToAnsi(colorTheme.model.bg, true),\n modelFg: hexToAnsi(colorTheme.model.fg, false),\n sessionBg: hexToAnsi(colorTheme.session.bg, true),\n sessionFg: hexToAnsi(colorTheme.session.fg, false),\n tmuxBg: hexToAnsi(colorTheme.tmux.bg, true),\n tmuxFg: hexToAnsi(colorTheme.tmux.fg, false),\n contextBg: hexToAnsi(colorTheme.context.bg, true),\n contextFg: hexToAnsi(colorTheme.context.fg, false),\n };\n }\n\n private getSegmentBgColor(\n segmentType: string,\n colors: PowerlineColors\n ): string {\n switch (segmentType) {\n case \"directory\":\n return colors.modeBg;\n case \"git\":\n return colors.gitBg;\n case \"model\":\n return colors.modelBg;\n case \"session\":\n return colors.sessionBg;\n case \"tmux\":\n return colors.tmuxBg;\n case \"context\":\n return colors.contextBg;\n default:\n return colors.modeBg;\n }\n }\n\n private formatSegment(\n bgColor: string,\n fgColor: string,\n text: string,\n nextBgColor?: string\n ): string {\n let output = `${bgColor}${fgColor} ${text} `;\n\n const reset = \"\\x1b[0m\";\n\n if (nextBgColor) {\n const arrowFgColor = extractBgToFg(bgColor);\n output += `${reset}${nextBgColor}${arrowFgColor}${this.symbols.right}`;\n } else {\n output += `${reset}${extractBgToFg(bgColor)}${this.symbols.right}${reset}`;\n }\n\n return output;\n }\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport os from \"node:os\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport type { ColorTheme } from \"../themes\";\nimport type {\n SegmentConfig,\n GitSegmentConfig,\n UsageSegmentConfig,\n TmuxSegmentConfig,\n ContextSegmentConfig,\n} from \"../segments/renderer\";\n\nexport interface LineConfig {\n segments: {\n directory?: SegmentConfig;\n git?: GitSegmentConfig;\n model?: SegmentConfig;\n session?: UsageSegmentConfig;\n tmux?: TmuxSegmentConfig;\n context?: ContextSegmentConfig;\n };\n}\n\nexport interface DisplayConfig {\n lines: LineConfig[];\n style?: \"minimal\" | \"powerline\";\n}\n\nexport interface BudgetItemConfig {\n amount?: number;\n warningThreshold?: number;\n}\n\nexport interface BudgetConfig {\n session?: BudgetItemConfig;\n}\n\nexport interface PowerlineConfig {\n theme: \"light\" | \"dark\" | \"nord\" | \"tokyo-night\" | \"rose-pine\" | \"custom\";\n display: DisplayConfig;\n colors?: {\n custom: ColorTheme;\n };\n budget?: BudgetConfig;\n usageType?: \"cost\" | \"tokens\" | \"both\" | \"breakdown\";\n}\n\nexport interface ConfigLoadOptions {\n configPath?: string;\n ignoreEnvVars?: boolean;\n cliOverrides?: Partial<PowerlineConfig>;\n projectDir?: string;\n}\n\nfunction deepMerge<T extends Record<string, any>>(\n target: T,\n source: Partial<T>\n): T {\n const result = { ...target };\n\n for (const key in source) {\n const sourceValue = source[key];\n if (sourceValue !== undefined) {\n if (\n typeof sourceValue === \"object\" &&\n sourceValue !== null &&\n !Array.isArray(sourceValue)\n ) {\n const targetValue = result[key] || {};\n result[key] = deepMerge(\n targetValue as Record<string, any>,\n sourceValue as Record<string, any>\n ) as T[Extract<keyof T, string>];\n } else if (Array.isArray(sourceValue) && sourceValue.length === 0) {\n const targetValue = result[key];\n if (!Array.isArray(targetValue) || targetValue.length > 0) {\n continue;\n } else {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n } else {\n result[key] = sourceValue as T[Extract<keyof T, string>];\n }\n }\n }\n\n return result;\n}\n\nfunction findConfigFile(\n customPath?: string,\n projectDir?: string\n): string | null {\n if (customPath) {\n return fs.existsSync(customPath) ? customPath : null;\n }\n\n const locations = [\n ...(projectDir ? [path.join(projectDir, \".claude-powerline.json\")] : []),\n path.join(process.cwd(), \".claude-powerline.json\"),\n path.join(os.homedir(), \".claude\", \"claude-powerline.json\"),\n path.join(os.homedir(), \".config\", \"claude-powerline\", \"config.json\"),\n ];\n\n return locations.find(fs.existsSync) || null;\n}\n\nfunction loadConfigFile(filePath: string): Partial<PowerlineConfig> {\n try {\n const content = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(content);\n } catch (error) {\n throw new Error(\n `Failed to load config file ${filePath}: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\nfunction loadEnvConfig(): Partial<PowerlineConfig> {\n const config: Partial<PowerlineConfig> = {};\n\n if (process.env.CLAUDE_POWERLINE_THEME) {\n config.theme = process.env.CLAUDE_POWERLINE_THEME as\n | \"light\"\n | \"dark\"\n | \"custom\";\n }\n\n if (process.env.CLAUDE_POWERLINE_STYLE) {\n if (!config.display) {\n config.display = { lines: [] };\n }\n const style = process.env.CLAUDE_POWERLINE_STYLE;\n if (style === \"minimal\" || style === \"powerline\") {\n config.display.style = style;\n } else {\n console.warn(\n `Invalid display style '${style}' from environment variable, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n }\n\n if (process.env.CLAUDE_POWERLINE_USAGE_TYPE) {\n const usageType = process.env.CLAUDE_POWERLINE_USAGE_TYPE as\n | \"cost\"\n | \"tokens\"\n | \"both\"\n | \"breakdown\";\n if ([\"cost\", \"tokens\", \"both\", \"breakdown\"].includes(usageType)) {\n config.usageType = usageType;\n }\n }\n\n return config;\n}\n\nfunction getConfigPathFromEnv(): string | undefined {\n return process.env.CLAUDE_POWERLINE_CONFIG;\n}\n\nfunction parseCLIOverrides(args: string[]): Partial<PowerlineConfig> {\n const config: Partial<PowerlineConfig> = {};\n\n const themeIndex = args.findIndex((arg) => arg.startsWith(\"--theme=\"));\n if (themeIndex !== -1) {\n const theme = args[themeIndex]?.split(\"=\")[1];\n if (theme) {\n config.theme = theme as \"light\" | \"dark\" | \"custom\";\n }\n }\n\n const styleIndex = args.findIndex((arg) => arg.startsWith(\"--style=\"));\n if (styleIndex !== -1) {\n const style = args[styleIndex]?.split(\"=\")[1];\n if (style) {\n if (!config.display) {\n config.display = { lines: [] };\n }\n if (style === \"minimal\" || style === \"powerline\") {\n config.display.style = style;\n } else {\n console.warn(\n `Invalid display style '${style}' from CLI argument, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n }\n }\n\n\n const sessionBudgetIndex = args.findIndex((arg) =>\n arg.startsWith(\"--session-budget=\")\n );\n if (sessionBudgetIndex !== -1) {\n const sessionBudget = parseFloat(\n args[sessionBudgetIndex]?.split(\"=\")[1] || \"\"\n );\n if (!isNaN(sessionBudget) && sessionBudget > 0) {\n config.budget = {\n ...config.budget,\n session: {\n ...DEFAULT_CONFIG.budget?.session,\n amount: sessionBudget,\n },\n };\n }\n }\n\n const usageIndex = args.findIndex((arg) => arg.startsWith(\"--usage=\"));\n if (usageIndex !== -1) {\n const usageType = args[usageIndex]?.split(\"=\")[1] as\n | \"cost\"\n | \"tokens\"\n | \"both\"\n | \"breakdown\";\n if (\n usageType &&\n [\"cost\", \"tokens\", \"both\", \"breakdown\"].includes(usageType)\n ) {\n config.usageType = usageType;\n }\n }\n\n return config;\n}\n\nexport function loadConfig(options: ConfigLoadOptions = {}): PowerlineConfig {\n const {\n configPath,\n ignoreEnvVars = false,\n cliOverrides = {},\n projectDir,\n } = options;\n\n let config: PowerlineConfig = JSON.parse(JSON.stringify(DEFAULT_CONFIG));\n\n const configFile = findConfigFile(configPath, projectDir);\n if (configFile) {\n try {\n const fileConfig = loadConfigFile(configFile);\n config = deepMerge(config, fileConfig);\n } catch (err) {\n console.warn(\n `Warning: ${err instanceof Error ? err.message : String(err)}`\n );\n }\n }\n\n if (\n config.display?.style &&\n config.display.style !== \"minimal\" &&\n config.display.style !== \"powerline\"\n ) {\n console.warn(\n `Invalid display style '${config.display.style}' in config file, falling back to 'minimal'`\n );\n config.display.style = \"minimal\";\n }\n\n if (!ignoreEnvVars) {\n const envConfig = loadEnvConfig();\n config = deepMerge(config, envConfig);\n }\n\n config = deepMerge(config, cliOverrides);\n\n if (config.usageType) {\n config.display.lines.forEach((line) => {\n if (line.segments.session) {\n line.segments.session.type = config.usageType!;\n }\n });\n delete config.usageType;\n }\n\n return config;\n}\n\nexport function loadConfigFromCLI(\n args: string[] = process.argv,\n projectDir?: string\n): PowerlineConfig {\n const configPathIndex = args.findIndex((arg) => arg.startsWith(\"--config=\"));\n const configPath =\n configPathIndex !== -1\n ? args[configPathIndex]?.split(\"=\")[1]\n : getConfigPathFromEnv();\n\n const cliOverrides = parseCLIOverrides(args);\n\n return loadConfig({ configPath, cliOverrides, projectDir });\n}\n\nexport function getConfigPath(\n customPath?: string,\n projectDir?: string\n): string | null {\n return findConfigFile(customPath, projectDir);\n}\n","import type { PowerlineConfig } from \"./loader\";\n\nexport const DEFAULT_CONFIG: PowerlineConfig = {\n theme: \"dark\",\n display: {\n style: \"minimal\",\n lines: [\n {\n segments: {\n directory: { enabled: true },\n git: {\n enabled: true,\n showSha: false,\n },\n model: { enabled: true },\n session: { enabled: true, type: \"tokens\" },\n tmux: { enabled: false },\n context: { enabled: true },\n },\n },\n ],\n },\n budget: {\n session: {\n warningThreshold: 80,\n },\n },\n};\n"],"mappings":";;;;;;;;;AAEA,OAAOA,cAAa;AACpB,OAAOC,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,YAAAC,iBAAgB;AACzB,OAAOC,SAAQ;AACf,SAAS,YAAY;;;ACPd,SAAS,UAAU,KAAa,cAA+B;AACpE,QAAM,IAAI,SAAS,IAAI,M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AM,WAAY,MAAM,KAAKA,SAAQ,KAAK;AAC1C,UAAM,uBAAuB,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAE9D,QAAI,CAAC,UAAU;AACb,cAAQ,MAAM,0CAA0C;AACxD,cAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAejB;AACK,MAAAA,SAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,aAAa,SAAS,WAAW;AACvC,UAAM,SAAS,kBAAkBA,SAAQ,MAAM,UAAU;AACzD,UAAM,WAAW,IAAI,kBAAkB,MAAM;AAC7C,UAAM,aAAa,MAAM,SAAS,mBAAmB,QAAQ;AAE7D,YAAQ,IAAI,UAAU;AAAA,EACxB,SAAS,OAAO;AACd,UAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC1E,YAAQ,MAAM,gCAAgC,YAAY;AAC1D,IAAAA,SAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,KAAK;","names":["process","path","fs","execSync","os","execSync","execSync","homedir","join","readFileSync","fs","path","fs","path","os","path","fs","execSync","process"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owloops/claude-powerline",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Beautiful vim-style powerline statusline for Claude Code with real-time cost tracking, git integration, and custom themes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",