ccburn 0.3.0__tar.gz → 0.3.1__tar.gz
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.
- {ccburn-0.3.0/src/ccburn.egg-info → ccburn-0.3.1}/PKG-INFO +1 -1
- {ccburn-0.3.0 → ccburn-0.3.1}/pyproject.toml +1 -1
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/app.py +17 -31
- {ccburn-0.3.0 → ccburn-0.3.1/src/ccburn.egg-info}/PKG-INFO +1 -1
- {ccburn-0.3.0 → ccburn-0.3.1}/LICENSE +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/README.md +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/setup.cfg +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/__init__.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/cli.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/data/__init__.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/data/credentials.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/data/history.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/data/models.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/data/usage_client.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/display/__init__.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/display/chart.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/display/gauges.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/display/layout.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/main.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/utils/__init__.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/utils/calculator.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn/utils/formatting.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn.egg-info/SOURCES.txt +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn.egg-info/dependency_links.txt +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn.egg-info/entry_points.txt +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn.egg-info/requires.txt +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/src/ccburn.egg-info/top_level.txt +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/tests/test_calculator.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/tests/test_cli.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/tests/test_formatting.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/tests/test_history.py +0 -0
- {ccburn-0.3.0 → ccburn-0.3.1}/tests/test_models.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ccburn"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "Terminal-based Claude Code usage limit visualizer with real-time burn-up charts"
|
|
9
9
|
authors = [{name = "JuanjoFuchs"}]
|
|
10
10
|
readme = "README.md"
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import os
|
|
4
4
|
import signal
|
|
5
5
|
import threading
|
|
6
|
-
import time
|
|
7
6
|
from datetime import datetime, timedelta, timezone
|
|
8
7
|
from typing import Any
|
|
9
8
|
|
|
@@ -71,7 +70,8 @@ class CCBurnApp:
|
|
|
71
70
|
self.layout = BurnupLayout(self.console)
|
|
72
71
|
|
|
73
72
|
# State
|
|
74
|
-
self.running =
|
|
73
|
+
self.running = True
|
|
74
|
+
self._stop_event = threading.Event() # For interruptible sleep
|
|
75
75
|
self.last_snapshot: UsageSnapshot | None = None
|
|
76
76
|
self.last_fetch_time: datetime | None = None
|
|
77
77
|
self.last_error: str | None = None
|
|
@@ -197,18 +197,6 @@ class CCBurnApp:
|
|
|
197
197
|
self.last_error = f"Unexpected error: {e}"
|
|
198
198
|
return False
|
|
199
199
|
|
|
200
|
-
def _should_refresh(self) -> bool:
|
|
201
|
-
"""Check if we should fetch new data.
|
|
202
|
-
|
|
203
|
-
Returns:
|
|
204
|
-
True if it's time to refresh
|
|
205
|
-
"""
|
|
206
|
-
if self.last_fetch_time is None:
|
|
207
|
-
return True
|
|
208
|
-
|
|
209
|
-
elapsed = (datetime.now(timezone.utc) - self.last_fetch_time).total_seconds()
|
|
210
|
-
return elapsed >= self.interval
|
|
211
|
-
|
|
212
200
|
def run(self) -> int:
|
|
213
201
|
"""Run the application.
|
|
214
202
|
|
|
@@ -311,7 +299,7 @@ class CCBurnApp:
|
|
|
311
299
|
Exit code
|
|
312
300
|
"""
|
|
313
301
|
self._setup_signal_handlers()
|
|
314
|
-
self.running
|
|
302
|
+
self.running = True
|
|
315
303
|
|
|
316
304
|
try:
|
|
317
305
|
# Create initial display
|
|
@@ -333,7 +321,7 @@ class CCBurnApp:
|
|
|
333
321
|
with Live(
|
|
334
322
|
initial_layout,
|
|
335
323
|
console=self.console,
|
|
336
|
-
|
|
324
|
+
auto_refresh=False, # Manual refresh only - saves CPU
|
|
337
325
|
transient=False,
|
|
338
326
|
screen=True,
|
|
339
327
|
vertical_overflow="visible",
|
|
@@ -358,18 +346,14 @@ class CCBurnApp:
|
|
|
358
346
|
Args:
|
|
359
347
|
live: Rich Live instance
|
|
360
348
|
"""
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
while self.running.is_set():
|
|
349
|
+
while self.running:
|
|
364
350
|
try:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
# Check if we should refresh data
|
|
368
|
-
if self._should_refresh():
|
|
369
|
-
self._fetch_and_update()
|
|
351
|
+
# Fetch new data
|
|
352
|
+
data_changed = self._fetch_and_update()
|
|
370
353
|
|
|
371
|
-
#
|
|
372
|
-
|
|
354
|
+
# Only re-render layout when data actually changes
|
|
355
|
+
# This avoids expensive chart re-rendering
|
|
356
|
+
if data_changed:
|
|
373
357
|
limit_data = None
|
|
374
358
|
if self.last_snapshot:
|
|
375
359
|
limit_data = self.last_snapshot.get_limit(self.limit_type)
|
|
@@ -387,15 +371,16 @@ class CCBurnApp:
|
|
|
387
371
|
since_duration=self.since_duration,
|
|
388
372
|
)
|
|
389
373
|
live.update(updated_layout)
|
|
374
|
+
live.refresh() # Manual refresh since auto_refresh=False
|
|
390
375
|
self._update_window_title()
|
|
391
|
-
last_update = current_time
|
|
392
376
|
|
|
393
|
-
#
|
|
394
|
-
|
|
377
|
+
# Sleep until next refresh interval
|
|
378
|
+
# Use Event.wait() for interruptible sleep on shutdown
|
|
379
|
+
self._stop_event.wait(timeout=self.interval)
|
|
395
380
|
|
|
396
381
|
except Exception:
|
|
397
382
|
# Log but continue
|
|
398
|
-
|
|
383
|
+
self._stop_event.wait(timeout=self.interval)
|
|
399
384
|
|
|
400
385
|
def _create_json_output(self) -> dict:
|
|
401
386
|
"""Create JSON output structure.
|
|
@@ -482,7 +467,8 @@ class CCBurnApp:
|
|
|
482
467
|
|
|
483
468
|
def stop(self) -> None:
|
|
484
469
|
"""Stop the application."""
|
|
485
|
-
self.running
|
|
470
|
+
self.running = False
|
|
471
|
+
self._stop_event.set() # Wake up from sleep immediately
|
|
486
472
|
|
|
487
473
|
def _update_window_title(self) -> None:
|
|
488
474
|
"""Update terminal window title with current status."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|