token-tracker 0.2.1__tar.gz → 0.2.3__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.
Files changed (25) hide show
  1. {token_tracker-0.2.1 → token_tracker-0.2.3}/PKG-INFO +1 -1
  2. {token_tracker-0.2.1 → token_tracker-0.2.3}/README.md +1 -0
  3. {token_tracker-0.2.1 → token_tracker-0.2.3}/pyproject.toml +1 -1
  4. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/cli.py +13 -5
  5. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/PKG-INFO +1 -1
  6. {token_tracker-0.2.1 → token_tracker-0.2.3}/setup.cfg +0 -0
  7. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/__init__.py +0 -0
  8. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/__init__.py +0 -0
  9. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/claude.py +0 -0
  10. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/codex.py +0 -0
  11. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/rate_limits.py +0 -0
  12. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/registry.py +0 -0
  13. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/adapters/types.py +0 -0
  14. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/analyzer/__init__.py +0 -0
  15. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/analyzer/aggregator.py +0 -0
  16. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/analyzer/blocks.py +0 -0
  17. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/analyzer/cost.py +0 -0
  18. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/hooks.py +0 -0
  19. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/ui/__init__.py +0 -0
  20. {token_tracker-0.2.1 → token_tracker-0.2.3}/src/ui/tables.py +0 -0
  21. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/SOURCES.txt +0 -0
  22. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/dependency_links.txt +0 -0
  23. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/entry_points.txt +0 -0
  24. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/requires.txt +0 -0
  25. {token_tracker-0.2.1 → token_tracker-0.2.3}/token_tracker.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: rich>=13.7
@@ -49,6 +49,7 @@ curl -sSL https://raw.githubusercontent.com/stormzhang/token-tracker/master/inst
49
49
 
50
50
  ```bash
51
51
  pip install token-tracker
52
+ tt setup
52
53
  ```
53
54
 
54
55
  ## 使用
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "token-tracker"
7
- version = "0.2.1"
7
+ version = "0.2.3"
8
8
  description = "Track token usage across local AI agents (Claude Code, Codex)"
9
9
  requires-python = ">=3.11"
10
10
  dependencies = [
@@ -72,14 +72,14 @@ def _show_interactive_dashboard(agents):
72
72
  import src.ui.tables as _tables
73
73
 
74
74
  agent_names = [a.name for a in agents]
75
- console.print(f"[dim]加载数据...[/dim]")
76
- cache = {a.id: _build_agent_data(a.id, a.name) for a in agents}
77
-
78
75
  current = 0
79
76
  orig = _tables.console
80
77
 
81
78
  sys.stdout.write("\033[?1049h\033[?25l")
79
+ sys.stdout.write("\033[H\033[J\033[2m加载数据...\033[0m")
82
80
  sys.stdout.flush()
81
+ cache = {a.id: _build_agent_data(a.id, a.name) for a in agents}
82
+
83
83
  try:
84
84
  while True:
85
85
  buf = StringIO()
@@ -94,7 +94,7 @@ def _show_interactive_dashboard(agents):
94
94
  _tables.console.print(f"[yellow]暂无数据[/yellow]")
95
95
  _tables.console = orig
96
96
 
97
- sys.stdout.write("\033[2J\033[H" + buf.getvalue())
97
+ sys.stdout.write("\033[H\033[J" + buf.getvalue())
98
98
  sys.stdout.flush()
99
99
 
100
100
  key = _read_key(tty, termios)
@@ -140,10 +140,18 @@ def _read_key(tty, termios):
140
140
  termios.tcsetattr(fd, termios.TCSADRAIN, old)
141
141
 
142
142
 
143
+ def _get_version() -> str:
144
+ from importlib.metadata import version
145
+ return version("token-tracker")
146
+
147
+
143
148
  def main():
144
149
  args = sys.argv[1:]
145
150
  command = args[0] if args else "dashboard"
146
151
 
152
+ if command in ("--version", "-v", "-V"):
153
+ print(f"tt {_get_version()}")
154
+ return
147
155
  if command == "setup":
148
156
  setup()
149
157
  return
@@ -215,7 +223,7 @@ def main():
215
223
  render_sessions(stats, limit)
216
224
  else:
217
225
  console.print(f"[red]未知命令: {command}[/red]")
218
- console.print("[dim]可用命令: dashboard, daily, weekly, monthly, sessions, claude, codex, setup, unsetup[/dim]")
226
+ console.print("[dim]可用命令: dashboard, daily, weekly, monthly, sessions, claude, codex, setup, unsetup, --version[/dim]")
219
227
  sys.exit(1)
220
228
 
221
229
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: token-tracker
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Track token usage across local AI agents (Claude Code, Codex)
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: rich>=13.7
File without changes