toknt 0.1.0__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 (113) hide show
  1. toknt-0.1.0/.github/workflows/ci.yml +39 -0
  2. toknt-0.1.0/.github/workflows/publish.yml +29 -0
  3. toknt-0.1.0/.gitignore +9 -0
  4. toknt-0.1.0/.python-version +1 -0
  5. toknt-0.1.0/CHANGELOG.md +32 -0
  6. toknt-0.1.0/LICENSE +21 -0
  7. toknt-0.1.0/PKG-INFO +547 -0
  8. toknt-0.1.0/Plan.md +454 -0
  9. toknt-0.1.0/README.md +518 -0
  10. toknt-0.1.0/pyproject.toml +82 -0
  11. toknt-0.1.0/src/toknt/__init__.py +5 -0
  12. toknt-0.1.0/src/toknt/adapters/__init__.py +99 -0
  13. toknt-0.1.0/src/toknt/adapters/amp_like.py +379 -0
  14. toknt-0.1.0/src/toknt/adapters/base.py +203 -0
  15. toknt-0.1.0/src/toknt/adapters/claude_code.py +741 -0
  16. toknt-0.1.0/src/toknt/adapters/claude_like.py +104 -0
  17. toknt-0.1.0/src/toknt/adapters/cline_like.py +706 -0
  18. toknt-0.1.0/src/toknt/adapters/codex.py +821 -0
  19. toknt-0.1.0/src/toknt/adapters/codex_like.py +31 -0
  20. toknt-0.1.0/src/toknt/adapters/gemini_like.py +517 -0
  21. toknt-0.1.0/src/toknt/adapters/goose_like.py +231 -0
  22. toknt-0.1.0/src/toknt/adapters/grok_like.py +451 -0
  23. toknt-0.1.0/src/toknt/adapters/jsonl.py +91 -0
  24. toknt-0.1.0/src/toknt/adapters/kiro_like.py +406 -0
  25. toknt-0.1.0/src/toknt/adapters/opencode.py +766 -0
  26. toknt-0.1.0/src/toknt/adapters/pi_like.py +563 -0
  27. toknt-0.1.0/src/toknt/analytics/__init__.py +95 -0
  28. toknt-0.1.0/src/toknt/analytics/aggregation.py +1107 -0
  29. toknt-0.1.0/src/toknt/analytics/costs.py +217 -0
  30. toknt-0.1.0/src/toknt/analytics/model_names.py +154 -0
  31. toknt-0.1.0/src/toknt/analytics/quality.py +133 -0
  32. toknt-0.1.0/src/toknt/analytics/tool_metrics.py +185 -0
  33. toknt-0.1.0/src/toknt/cli.py +1128 -0
  34. toknt-0.1.0/src/toknt/config.py +236 -0
  35. toknt-0.1.0/src/toknt/discovery/__init__.py +556 -0
  36. toknt-0.1.0/src/toknt/models/__init__.py +37 -0
  37. toknt-0.1.0/src/toknt/models/events.py +314 -0
  38. toknt-0.1.0/src/toknt/models/usage.py +106 -0
  39. toknt-0.1.0/src/toknt/palette.py +27 -0
  40. toknt-0.1.0/src/toknt/presentation/__init__.py +10 -0
  41. toknt-0.1.0/src/toknt/presentation/charts.py +311 -0
  42. toknt-0.1.0/src/toknt/presentation/dashboard.py +214 -0
  43. toknt-0.1.0/src/toknt/presentation/graphics.py +821 -0
  44. toknt-0.1.0/src/toknt/presentation/tables.py +243 -0
  45. toknt-0.1.0/src/toknt/service.py +116 -0
  46. toknt-0.1.0/src/toknt/storage/__init__.py +45 -0
  47. toknt-0.1.0/src/toknt/storage/database.py +59 -0
  48. toknt-0.1.0/src/toknt/storage/ingestion.py +551 -0
  49. toknt-0.1.0/src/toknt/storage/migrations.py +261 -0
  50. toknt-0.1.0/src/toknt/storage/pricing.py +103 -0
  51. toknt-0.1.0/src/toknt/tui/app.py +488 -0
  52. toknt-0.1.0/src/toknt/tui/data.py +315 -0
  53. toknt-0.1.0/src/toknt/tui/keys.py +228 -0
  54. toknt-0.1.0/src/toknt/tui/painter.py +213 -0
  55. toknt-0.1.0/src/toknt/tui/style.py +47 -0
  56. toknt-0.1.0/src/toknt/tui/term.py +73 -0
  57. toknt-0.1.0/src/toknt/tui/views.py +1660 -0
  58. toknt-0.1.0/src/toknt/tui/widgets.py +489 -0
  59. toknt-0.1.0/src/toknt/util.py +14 -0
  60. toknt-0.1.0/tests/__init__.py +1 -0
  61. toknt-0.1.0/tests/conftest.py +102 -0
  62. toknt-0.1.0/tests/fixtures/README.md +14 -0
  63. toknt-0.1.0/tests/fixtures/canonical_tool_events.jsonl +3 -0
  64. toknt-0.1.0/tests/fixtures/canonical_usage_events.jsonl +3 -0
  65. toknt-0.1.0/tests/support/__init__.py +1 -0
  66. toknt-0.1.0/tests/support/claude_files.py +267 -0
  67. toknt-0.1.0/tests/support/codex_files.py +408 -0
  68. toknt-0.1.0/tests/support/models.py +104 -0
  69. toknt-0.1.0/tests/support/opencode_db.py +539 -0
  70. toknt-0.1.0/tests/test_adapters/test_claude_code.py +479 -0
  71. toknt-0.1.0/tests/test_adapters/test_claude_like.py +186 -0
  72. toknt-0.1.0/tests/test_adapters/test_cline_like.py +269 -0
  73. toknt-0.1.0/tests/test_adapters/test_codex.py +525 -0
  74. toknt-0.1.0/tests/test_adapters/test_gemini_like.py +197 -0
  75. toknt-0.1.0/tests/test_adapters/test_grok_like.py +198 -0
  76. toknt-0.1.0/tests/test_adapters/test_live_harnesses.py +227 -0
  77. toknt-0.1.0/tests/test_adapters/test_opencode.py +479 -0
  78. toknt-0.1.0/tests/test_adapters/test_pi_like.py +283 -0
  79. toknt-0.1.0/tests/test_analytics/test_aggregation.py +793 -0
  80. toknt-0.1.0/tests/test_analytics/test_costs.py +187 -0
  81. toknt-0.1.0/tests/test_analytics/test_merge_models.py +219 -0
  82. toknt-0.1.0/tests/test_analytics/test_model_names.py +138 -0
  83. toknt-0.1.0/tests/test_analytics/test_tool_metrics.py +134 -0
  84. toknt-0.1.0/tests/test_cli/test_cli.py +69 -0
  85. toknt-0.1.0/tests/test_cli/test_commands.py +380 -0
  86. toknt-0.1.0/tests/test_cli/test_help_and_tui.py +93 -0
  87. toknt-0.1.0/tests/test_config.py +138 -0
  88. toknt-0.1.0/tests/test_discovery.py +110 -0
  89. toknt-0.1.0/tests/test_models/test_events.py +187 -0
  90. toknt-0.1.0/tests/test_models/test_usage.py +109 -0
  91. toknt-0.1.0/tests/test_performance.py +592 -0
  92. toknt-0.1.0/tests/test_presentation/test_charts.py +140 -0
  93. toknt-0.1.0/tests/test_presentation/test_graphics.py +248 -0
  94. toknt-0.1.0/tests/test_presentation/test_graphics_protocol.py +170 -0
  95. toknt-0.1.0/tests/test_presentation/test_sixel.py +157 -0
  96. toknt-0.1.0/tests/test_storage/test_database.py +65 -0
  97. toknt-0.1.0/tests/test_storage/test_ingestion.py +278 -0
  98. toknt-0.1.0/tests/test_storage/test_migrations.py +81 -0
  99. toknt-0.1.0/tests/test_tui/__init__.py +0 -0
  100. toknt-0.1.0/tests/test_tui/test_data.py +99 -0
  101. toknt-0.1.0/tests/test_tui/test_graphics_wiring.py +173 -0
  102. toknt-0.1.0/tests/test_tui/test_keys.py +187 -0
  103. toknt-0.1.0/tests/test_tui/test_live_window.py +239 -0
  104. toknt-0.1.0/tests/test_tui/test_merge_toggle.py +163 -0
  105. toknt-0.1.0/tests/test_tui/test_page_one.py +232 -0
  106. toknt-0.1.0/tests/test_tui/test_painter.py +116 -0
  107. toknt-0.1.0/tests/test_tui/test_rate_toggle.py +239 -0
  108. toknt-0.1.0/tests/test_tui/test_scaling.py +207 -0
  109. toknt-0.1.0/tests/test_tui/test_term_write.py +52 -0
  110. toknt-0.1.0/tests/test_tui/test_views_app.py +409 -0
  111. toknt-0.1.0/tests/test_tui/test_visuals.py +652 -0
  112. toknt-0.1.0/tests/test_tui/test_widgets.py +183 -0
  113. toknt-0.1.0/uv.lock +204 -0
@@ -0,0 +1,39 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ name: Test (Python ${{ matrix.python-version }})
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [macos-14, macos-15, ubuntu-latest]
21
+ python-version: ["3.12", "3.13"]
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - uses: astral-sh/setup-uv@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+ enable-cache: true
28
+ - name: Install
29
+ run: uv sync --frozen
30
+ - name: Tests
31
+ run: uv run pytest
32
+ - name: Lint
33
+ run: uv run ruff check .
34
+ - name: The package builds and installs
35
+ run: |
36
+ uv build --out-dir dist
37
+ uv tool install --force dist/*.whl
38
+ toknt --version
39
+ toknt --help > /dev/null
@@ -0,0 +1,29 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ name: Build and publish to PyPI
14
+ runs-on: ubuntu-latest
15
+ environment:
16
+ name: pypi
17
+ url: https://pypi.org/p/toknt
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: astral-sh/setup-uv@v5
21
+ - name: Build
22
+ run: uv build --out-dir dist
23
+ - name: Check the distributions
24
+ run: uvx twine check dist/*
25
+ - name: Publish
26
+ uses: pypa/gh-action-pypi-publish@release/v1
27
+ with:
28
+ password: ${{ secrets.PYPI_API_TOKEN }}
29
+ skip-existing: true
toknt-0.1.0/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to `toknt` are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [semantic versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.0] — 2026-10-23
8
+
9
+ The first public release: local-first token, cost and tool analytics for AI
10
+ coding harnesses.
11
+
12
+ ### Added
13
+
14
+ - **Interactive TUI** — contribution graph of tokens per day, per-model
15
+ series with a token-share donut, cache-hit-rate bars that mirror the model
16
+ table, tool outcomes, session rankings, and live 3h/5h/1d windows that
17
+ rescan in the background.
18
+ - **Logarithmic token charts** — token counts plot on a log axis, so a
19
+ 5M-token model stays visible next to a 250M one. tok/s stays linear.
20
+ - **True image charts** — anti-aliased PNG output over the kitty, iTerm2 and
21
+ sixel protocols, with a Braille-cell fallback everywhere else.
22
+ - **21 harness sources** — OpenCode, Codex CLI, Claude Code, Cline, pi, Grok
23
+ Build, Gemini CLI and more, normalized into a canonical model.
24
+ - **Strict token semantics** — incomplete counts are never completed by
25
+ guessing, and reported costs stay separate from estimated ones.
26
+ - **Commands** — `overview`, `scan`, `usage`, `models`, `tools`, `sessions`,
27
+ `export`, `doctor`, `graphics`.
28
+ - **Derived tok/s** — mean generation rate per model, derived from message
29
+ gaps with the sources' own reporting schemes.
30
+ - `toknt doctor` for source discovery, coverage and data-quality issues.
31
+
32
+ [0.1.0]: https://github.com/BitPeppr/toknt/releases/tag/v0.1.0
toknt-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Martin Chen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.