@owloops/claude-powerline 1.4.5 → 1.5.1

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
@@ -52,6 +52,8 @@
52
52
 
53
53
  - **Vim-style powerline** with proper arrows and segments
54
54
  - **Real-time session tracking** with costs and tokens
55
+ - **Billing window tracking** with 5-hour block usage
56
+ - **Daily usage monitoring** with budget alerts
55
57
  - **Performance metrics** with response times and burn rates
56
58
  - **Context monitoring** showing tokens used and auto-compact threshold
57
59
  - **Git integration** with branch, status, ahead/behind counts
@@ -119,15 +121,15 @@ Options are specified by command line flags. Overall configuration can also use
119
121
 
120
122
  ## Command Line Options
121
123
 
122
- | Option | Values | Description |
123
- |--------|--------|-------------|
124
- | `--theme` | `dark` (default), `light`, `nord`, `tokyo-night`, `rose-pine`, `custom` | Set color theme |
125
- | `--style` | `minimal` (default), `powerline` | Set separator style |
126
- | `--usage` | `cost`, `tokens`, `both`, `breakdown` | Set usage display format |
127
- | `--session-budget` | `AMOUNT` | Set session budget limit in USD |
128
- | `--config` | `PATH` | Use custom config file path |
129
- | `--install-fonts` | - | Install powerline fonts to system |
130
- | `-h, --help` | - | Show help message |
124
+ | Option | Values | Description |
125
+ | ------------------ | ----------------------------------------------------------------------- | --------------------------------- |
126
+ | `--theme` | `dark` (default), `light`, `nord`, `tokyo-night`, `rose-pine`, `custom` | Set color theme |
127
+ | `--style` | `minimal` (default), `powerline` | Set separator style |
128
+ | `--usage` | `cost`, `tokens`, `both`, `breakdown` | Set usage display format |
129
+ | `--session-budget` | `AMOUNT` | Set session budget limit in USD |
130
+ | `--config` | `PATH` | Use custom config file path |
131
+ | `--install-fonts` | - | Install powerline fonts to system |
132
+ | `-h, --help` | - | Show help message |
131
133
 
132
134
  > [!NOTE]
133
135
  > Global options have CLI flags and environment variables. Individual segments are configured through config files.
@@ -144,7 +146,7 @@ Options are specified by command line flags. Overall configuration can also use
144
146
  ### Default Configuration
145
147
 
146
148
  ```bash
147
- # Shows directory, git, model, session usage (tokens), context info
149
+ # Shows directory, git, model, session usage (tokens), block usage, context info
148
150
  # Uses dark theme, minimal style
149
151
  claude-powerline
150
152
  ```
@@ -171,8 +173,21 @@ claude-powerline --session-budget=50
171
173
 
172
174
  ### Status Indicators
173
175
 
176
+ #### Symbols
177
+
178
+ - **Session**: `§` Section sign for session costs
179
+ - **Block**: `◱` Clock symbol for 5-hour blocks
180
+ - **Today**: `☉` Sun symbol for daily usage
181
+ - **Git Branch**: `⎇` Branch symbol
182
+ - **Git Tag**: `⌂` House/tag symbol
183
+ - **Git SHA**: `♯` Hash symbol
184
+ - **Git Stash**: `⧇` Double square symbol
185
+ - **Metrics Delta**: `Δ` Delta for last response time
186
+
187
+ #### Status States
188
+
174
189
  - **Git**: `✓` Clean, `●` Dirty, `⚠` Conflicts, `↑3` Ahead, `↓2` Behind remote
175
- - **Context**: `⊡ 34,040 (79%)` - Token count and percentage remaining until auto-compact (uses 75% of 200k limit)
190
+ - **Context**: `◔ 34,040 (79%)` - Token count and percentage remaining until auto-compact
176
191
  - **Budget**: `25%` Normal (under 50%), `+75%` Moderate (50-79%), `!85%` Warning (80%+)
177
192
 
178
193
  ## Configuration
@@ -205,15 +220,31 @@ Configuration priority (top overrides bottom):
205
220
  "lines": [
206
221
  {
207
222
  "segments": {
208
- "directory": { "enabled": true },
209
- "git": { "enabled": true, "showSha": true },
223
+ "directory": {
224
+ "enabled": true,
225
+ "useBasename": false
226
+ },
227
+ "git": {
228
+ "enabled": true,
229
+ "showSha": true,
230
+ "showWorkingTree": false,
231
+ "showOperation": false,
232
+ "showTag": false,
233
+ "showTimeSinceCommit": false,
234
+ "showStashCount": false,
235
+ "showUpstream": false,
236
+ "showRepoName": false
237
+ },
210
238
  "model": { "enabled": true },
211
239
  "session": { "enabled": true, "type": "tokens" },
240
+ "block": { "enabled": true, "type": "cost" },
241
+ "today": { "enabled": true, "type": "cost" },
212
242
  "context": { "enabled": true },
213
243
  "tmux": { "enabled": true },
214
244
  "metrics": {
215
245
  "enabled": true,
216
246
  "showResponseTime": true,
247
+ "showLastResponseTime": false,
217
248
  "showDuration": true,
218
249
  "showMessageCount": true,
219
250
  "showCostBurnRate": false,
@@ -228,13 +259,51 @@ Configuration priority (top overrides bottom):
228
259
 
229
260
  ### Segment Details
230
261
 
231
- - **directory**: Current working directory name
232
- - **git**: Branch, status (clean/dirty), ahead/behind counts, SHA (optional)
262
+ - **directory**: Current working directory name (supports `useBasename` option)
263
+ - **git**: Branch, status, and extensive repository information (see Git Configuration below)
233
264
  - **model**: Current Claude model being used
234
265
  - **session**: Token usage and costs for current session
266
+ - **block**: Usage within current 5-hour billing window
267
+ - **today**: Total daily usage with budget monitoring
235
268
  - **context**: Context window usage and auto-compact threshold
236
269
  - **tmux**: Tmux session name and window info (when in tmux)
237
- - **metrics**: Performance analytics (response time, session duration, message count, burn rates)
270
+ - **metrics**: Performance analytics (see Metrics Configuration below)
271
+
272
+ #### Directory Configuration
273
+
274
+ ```json
275
+ "directory": {
276
+ "enabled": true,
277
+ "useBasename": false // Show only folder name instead of full path
278
+ }
279
+ ```
280
+
281
+ #### Git Configuration
282
+
283
+ The git segment now supports extensive repository information:
284
+
285
+ ```json
286
+ "git": {
287
+ "enabled": true,
288
+ "showSha": true, // Show abbreviated commit SHA (♯ abc123)
289
+ "showWorkingTree": false, // Show staged/unstaged/untracked counts ((+1 ~2 ?3))
290
+ "showOperation": false, // Show ongoing operations (MERGE/REBASE/CHERRY-PICK)
291
+ "showTag": false, // Show nearest tag (⌂ v1.5.0)
292
+ "showTimeSinceCommit": false, // Show time since last commit (⏰ 2h)
293
+ "showStashCount": false, // Show stash count (⧇ 3)
294
+ "showUpstream": false, // Show upstream branch (→ origin/main)
295
+ "showRepoName": false // Show repository name
296
+ }
297
+ ```
298
+
299
+ **Git Status Indicators:**
300
+
301
+ - `✓` Clean working tree
302
+ - `●` Uncommitted changes
303
+ - `⚠` Merge conflicts
304
+ - `↑3` Commits ahead of upstream
305
+ - `↓2` Commits behind upstream
306
+ - `(+1 ~2 ?3)` Staged/Unstaged/Untracked file counts
238
307
 
239
308
  #### Metrics Configuration
240
309
 
@@ -243,24 +312,91 @@ The metrics segment displays performance analytics from your Claude sessions:
243
312
  ```json
244
313
  "metrics": {
245
314
  "enabled": true,
246
- "showResponseTime": true,
247
- "showDuration": true,
248
- "showMessageCount": true,
249
- "showCostBurnRate": false,
250
- "showTokenBurnRate": false
315
+ "showResponseTime": true, // Average response time (`⧖ 3.2s`)
316
+ "showLastResponseTime": false, // Last response time (`Δ 2.8s`)
317
+ "showDuration": true, // Session duration (`⧗ 28m`)
318
+ "showMessageCount": true, // User message count (`⟐ 93`)
319
+ "showCostBurnRate": false, // Cost per hour (`⟢ $1.20/h`)
320
+ "showTokenBurnRate": false // Tokens per hour (`⟢ 450K/h`)
251
321
  }
252
322
  ```
253
323
 
254
- **Options:**
324
+ **Metrics Display:**
255
325
 
256
- - `showResponseTime`: Average response time per message (`⧖ 3.2s`)
257
- - `showDuration`: Total session duration (`⧗ 28m`)
258
- - `showMessageCount`: Number of user messages (`⟐ 93`)
259
- - `showCostBurnRate`: Cost burn rate per hour (`⟢ $1.20/h`)
260
- - `showTokenBurnRate`: Token burn rate per hour (`⟢ 450K/h`)
326
+ - `showResponseTime`: Average response time across all messages
327
+ - `showLastResponseTime`: Time for the last response (shows `0.0s` while waiting)
328
+ - `showDuration`: Total time since session started
329
+ - `showMessageCount`: Number of user messages sent
330
+ - `showCostBurnRate`: Spending rate per hour
331
+ - `showTokenBurnRate`: Token consumption rate per hour
261
332
 
262
333
  ![Metrics Segment Example](images/claude-powerline-metrics.png)
263
334
 
335
+ #### Usage Segments Configuration
336
+
337
+ The powerline includes three complementary usage segments:
338
+
339
+ ```json
340
+ {
341
+ "segments": {
342
+ "session": { "enabled": true, "type": "tokens" },
343
+ "block": { "enabled": true, "type": "cost" },
344
+ "today": { "enabled": true, "type": "cost" }
345
+ },
346
+ "budget": {
347
+ "session": { "amount": 10.0, "warningThreshold": 80 },
348
+ "today": { "amount": 25.0, "warningThreshold": 80 }
349
+ }
350
+ }
351
+ ```
352
+
353
+ **Segment Types:**
354
+
355
+ - **session**: Real-time usage for current Claude conversation
356
+ - **block**: Usage within current 5-hour billing window (Claude's rate limit period)
357
+ - **today**: Total daily usage with budget monitoring
358
+
359
+ **Display Options:**
360
+
361
+ **Session & Today segments:**
362
+
363
+ - `cost`: Show dollar amounts (`$0.05`)
364
+ - `tokens`: Show token counts (`1.2K tokens`)
365
+ - `both`: Show both (`$0.05 (1.2K)`)
366
+ - `breakdown`: Show token breakdown (`1.2Kin + 0.8Kout + 1.5Kcached`)
367
+
368
+ **Block segment** (always shows time remaining):
369
+
370
+ - `cost`: Show cost + time (`$0.05 (2h 30m left)`)
371
+ - `tokens`: Show tokens + time (`1.2K tokens (2h 30m left)`)
372
+
373
+ **Budget Configuration:**
374
+
375
+ ```json
376
+ "budget": {
377
+ "session": {
378
+ "amount": 10.0,
379
+ "warningThreshold": 80
380
+ },
381
+ "today": {
382
+ "amount": 25.0,
383
+ "warningThreshold": 80
384
+ }
385
+ }
386
+ ```
387
+
388
+ **Budget Indicators:**
389
+
390
+ - `25%` Normal (under 50%)
391
+ - `+75%` Moderate (50-79%)
392
+ - `!85%` Warning (80%+)
393
+
394
+ **Why Use Different Segments?**
395
+
396
+ - **session**: Track spending per conversation
397
+ - **block**: Monitor rate limits with time remaining (Claude throttles after 5-hour usage peaks)
398
+ - **today**: Stay within daily budgets
399
+
264
400
  ### Multi-line Layout (Optional)
265
401
 
266
402
  To prevent segment cutoff, configure multiple lines:
@@ -279,6 +415,8 @@ To prevent segment cutoff, configure multiple lines:
279
415
  {
280
416
  "segments": {
281
417
  "session": { "enabled": true, "type": "tokens" },
418
+ "block": { "enabled": true, "type": "cost" },
419
+ "today": { "enabled": true, "type": "cost" },
282
420
  "context": { "enabled": true },
283
421
  "tmux": { "enabled": false },
284
422
  "metrics": { "enabled": true }
@@ -305,6 +443,8 @@ To customize colors, copy dark or light theme colors from `src/themes/` in the r
305
443
  "git": { "bg": "#0066cc", "fg": "#ffffff" },
306
444
  "model": { "bg": "#9900cc", "fg": "#ffffff" },
307
445
  "session": { "bg": "#cc0099", "fg": "#ffffff" },
446
+ "block": { "bg": "#404040", "fg": "#cccccc" },
447
+ "today": { "bg": "#303030", "fg": "#dddddd" },
308
448
  "context": { "bg": "#4a5568", "fg": "#ffffff" },
309
449
  "tmux": { "bg": "#228b22", "fg": "#ffffff" },
310
450
  "metrics": { "bg": "#374151", "fg": "#ffffff" }
@@ -377,21 +517,7 @@ export CLAUDE_POWERLINE_THEME=dark
377
517
  export CLAUDE_POWERLINE_STYLE=powerline
378
518
  export CLAUDE_POWERLINE_USAGE_TYPE=tokens
379
519
  export CLAUDE_POWERLINE_CONFIG=/path/to/config.json
380
- ```
381
-
382
- ## Troubleshooting
383
-
384
- **Arrows not displaying?** Run `claude-powerline --install-fonts` and set terminal font to a powerline-patched font.
385
-
386
- **Cost showing N/A?** Check that Claude session files are accessible in ~/.claude directory.
387
-
388
- **Tmux segment not showing?** Ensure you're in a tmux session and enable it in config.
389
-
390
- **Debug logging:** Enable debug output to troubleshoot issues:
391
-
392
- ```bash
393
- export CLAUDE_POWERLINE_DEBUG=1
394
- # Then use Claude Code normally - debug info will appear in stderr
520
+ export CLAUDE_POWERLINE_DEBUG=1 # Enable debug logging
395
521
  ```
396
522
 
397
523
  ## Contributing