pacman-token-manager 3.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 (55) hide show
  1. pacman_token_manager-3.1.0/LICENSE +21 -0
  2. pacman_token_manager-3.1.0/PKG-INFO +194 -0
  3. pacman_token_manager-3.1.0/README.md +133 -0
  4. pacman_token_manager-3.1.0/pyproject.toml +205 -0
  5. pacman_token_manager-3.1.0/setup.cfg +4 -0
  6. pacman_token_manager-3.1.0/src/pacman/__init__.py +5 -0
  7. pacman_token_manager-3.1.0/src/pacman/__main__.py +20 -0
  8. pacman_token_manager-3.1.0/src/pacman/_version.py +143 -0
  9. pacman_token_manager-3.1.0/src/pacman/cli/__init__.py +5 -0
  10. pacman_token_manager-3.1.0/src/pacman/cli/bootstrap.py +80 -0
  11. pacman_token_manager-3.1.0/src/pacman/cli/main.py +478 -0
  12. pacman_token_manager-3.1.0/src/pacman/core/__init__.py +7 -0
  13. pacman_token_manager-3.1.0/src/pacman/core/calculations.py +203 -0
  14. pacman_token_manager-3.1.0/src/pacman/core/data_processors.py +244 -0
  15. pacman_token_manager-3.1.0/src/pacman/core/models.py +178 -0
  16. pacman_token_manager-3.1.0/src/pacman/core/p90_calculator.py +97 -0
  17. pacman_token_manager-3.1.0/src/pacman/core/plans.py +203 -0
  18. pacman_token_manager-3.1.0/src/pacman/core/pricing.py +230 -0
  19. pacman_token_manager-3.1.0/src/pacman/core/settings.py +366 -0
  20. pacman_token_manager-3.1.0/src/pacman/data/__init__.py +4 -0
  21. pacman_token_manager-3.1.0/src/pacman/data/aggregator.py +305 -0
  22. pacman_token_manager-3.1.0/src/pacman/data/analysis.py +237 -0
  23. pacman_token_manager-3.1.0/src/pacman/data/analyzer.py +385 -0
  24. pacman_token_manager-3.1.0/src/pacman/data/reader.py +322 -0
  25. pacman_token_manager-3.1.0/src/pacman/error_handling.py +156 -0
  26. pacman_token_manager-3.1.0/src/pacman/monitoring/__init__.py +7 -0
  27. pacman_token_manager-3.1.0/src/pacman/monitoring/data_manager.py +146 -0
  28. pacman_token_manager-3.1.0/src/pacman/monitoring/orchestrator.py +242 -0
  29. pacman_token_manager-3.1.0/src/pacman/monitoring/session_monitor.py +199 -0
  30. pacman_token_manager-3.1.0/src/pacman/monitoring/threshold_alert.py +169 -0
  31. pacman_token_manager-3.1.0/src/pacman/terminal/__init__.py +4 -0
  32. pacman_token_manager-3.1.0/src/pacman/terminal/input_handler.py +141 -0
  33. pacman_token_manager-3.1.0/src/pacman/terminal/manager.py +107 -0
  34. pacman_token_manager-3.1.0/src/pacman/terminal/themes.py +700 -0
  35. pacman_token_manager-3.1.0/src/pacman/ui/__init__.py +4 -0
  36. pacman_token_manager-3.1.0/src/pacman/ui/components.py +305 -0
  37. pacman_token_manager-3.1.0/src/pacman/ui/display_controller.py +1081 -0
  38. pacman_token_manager-3.1.0/src/pacman/ui/guidance.py +256 -0
  39. pacman_token_manager-3.1.0/src/pacman/ui/layouts.py +121 -0
  40. pacman_token_manager-3.1.0/src/pacman/ui/progress_bars.py +333 -0
  41. pacman_token_manager-3.1.0/src/pacman/ui/session_display.py +636 -0
  42. pacman_token_manager-3.1.0/src/pacman/ui/simple_display.py +379 -0
  43. pacman_token_manager-3.1.0/src/pacman/ui/table_views.py +384 -0
  44. pacman_token_manager-3.1.0/src/pacman/utils/__init__.py +3 -0
  45. pacman_token_manager-3.1.0/src/pacman/utils/formatting.py +95 -0
  46. pacman_token_manager-3.1.0/src/pacman/utils/model_utils.py +98 -0
  47. pacman_token_manager-3.1.0/src/pacman/utils/notifications.py +121 -0
  48. pacman_token_manager-3.1.0/src/pacman/utils/time_utils.py +527 -0
  49. pacman_token_manager-3.1.0/src/pacman/utils/timezone.py +86 -0
  50. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/PKG-INFO +194 -0
  51. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/SOURCES.txt +53 -0
  52. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/dependency_links.txt +1 -0
  53. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/entry_points.txt +6 -0
  54. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/requires.txt +34 -0
  55. pacman_token_manager-3.1.0/src/pacman_token_manager.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 tsuimou
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.
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: pacman-token-manager
3
+ Version: 3.1.0
4
+ Summary: A real-time terminal monitoring tool for Claude Code token usage with advanced analytics and Rich UI
5
+ Author: tsuimou
6
+ Maintainer: tsuimou
7
+ License: MIT
8
+ Project-URL: homepage, https://github.com/tsuimou/pacman-token-manager
9
+ Project-URL: repository, https://github.com/tsuimou/pacman-token-manager.git
10
+ Project-URL: documentation, https://github.com/tsuimou/pacman-token-manager#readme
11
+ Project-URL: issues, https://github.com/tsuimou/pacman-token-manager/issues
12
+ Keywords: ai,analytics,claude,dashboard,developer-tools,monitoring,rich,terminal,token,usage
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Console
15
+ Classifier: Environment :: Console :: Curses
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Topic :: Software Development :: Debuggers
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: System :: Monitoring
20
+ Classifier: Topic :: Terminals
21
+ Classifier: Topic :: Utilities
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: License :: OSI Approved :: MIT License
25
+ Classifier: Operating System :: OS Independent
26
+ Classifier: Operating System :: POSIX :: Linux
27
+ Classifier: Operating System :: MacOS
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: numpy>=1.21.0
33
+ Requires-Dist: pydantic>=2.0.0
34
+ Requires-Dist: pydantic-settings>=2.0.0
35
+ Requires-Dist: pyyaml>=6.0
36
+ Requires-Dist: pytz>=2023.3
37
+ Requires-Dist: rich>=13.7.0
38
+ Requires-Dist: tomli>=1.2.0; python_version < "3.11"
39
+ Requires-Dist: tzdata; sys_platform == "win32"
40
+ Provides-Extra: dev
41
+ Requires-Dist: black>=24.0.0; extra == "dev"
42
+ Requires-Dist: isort>=5.13.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.13.0; extra == "dev"
44
+ Requires-Dist: pre-commit>=4.0.0; extra == "dev"
45
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
46
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
47
+ Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
48
+ Requires-Dist: pytest-cov>=6.0.0; extra == "dev"
49
+ Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
50
+ Requires-Dist: pytest-xdist>=3.6.0; extra == "dev"
51
+ Requires-Dist: ruff>=0.12.0; extra == "dev"
52
+ Requires-Dist: build>=0.10.0; extra == "dev"
53
+ Requires-Dist: twine>=4.0.0; extra == "dev"
54
+ Provides-Extra: test
55
+ Requires-Dist: pytest>=8.0.0; extra == "test"
56
+ Requires-Dist: pytest-cov>=6.0.0; extra == "test"
57
+ Requires-Dist: pytest-mock>=3.14.0; extra == "test"
58
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == "test"
59
+ Requires-Dist: pytest-benchmark>=4.0.0; extra == "test"
60
+ Dynamic: license-file
61
+
62
+ # Pacman Token Manager
63
+
64
+ Tool for monitoring more detail info on token usage in your terminal.
65
+
66
+ ```
67
+ ┌──────────────────────────────────────────────────────────────┐
68
+ │ Pacman Token Manager │
69
+ ├──────────────────────────────────────────────────────────────┤
70
+ │ Halfway there · Resets in 4h 25m (started 10:00 AM) │
71
+ ├──────────────────────────────────────────────────────────────┤
72
+ │ │
73
+ │ TKN █████░░░░░░░░░░░░░░░ 27% 193,920 / 728,474 │
74
+ │ 534k left · Resets in 4h 25m │
75
+ │ │
76
+ ├─ Usage over time ────────────────────────────────────────────┤
77
+ │ │
78
+ │ Period Usage TKN │
79
+ │ Current session ███░░░░░░░░░ 27% 193k │
80
+ │ Resets in 4h 25m │
81
+ │ │
82
+ │ Current week 4.6m │
83
+ │ (7-day rolling total) │
84
+ │ │
85
+ ├─ Breakdown ──────────────────────────────────────────────────┤
86
+ │ │
87
+ │ By Model Usage TKN │
88
+ │ Opus ████████████ 183k │
89
+ │ Sonnet ░░░░░░░░░░░░ 10k │
90
+ │ │
91
+ ├─ Guidance ───────────────────────────────────────────────────┤
92
+ │ │
93
+ │ Opus is handling 75% of your work. Sonnet is often │
94
+ │ sufficient and more economical. │
95
+ │ │
96
+ │ → Switch to Sonnet? [Y]es [N]o thanks │
97
+ │ │
98
+ │ Ctrl+C to exit │
99
+ └──────────────────────────────────────────────────────────────┘
100
+ ```
101
+
102
+ ## Installation
103
+
104
+ ```bash
105
+ # From PyPI (after publishing)
106
+ pip install pacman-token-manager
107
+
108
+ # Or install from GitHub
109
+ pip install git+https://github.com/tsuimou/pacman-token-manager.git
110
+
111
+ # Or local development
112
+ pip install -e .
113
+ ```
114
+
115
+ ## Usage
116
+
117
+ ```bash
118
+ # Pick your favorite command
119
+ chomp
120
+ pac
121
+ pacman
122
+ pactkn
123
+ pacman-token-manager
124
+ ```
125
+
126
+ ## Features
127
+
128
+ - **Accurate token tracking** - Counts only billable tokens (excludes free cache reads)
129
+ - **All projects view** - Tracks usage across ALL your Claude Code projects
130
+ - **Matches Claude /usage** - Shows the same percentage as Claude's built-in `/usage`
131
+ - **Human-first design** - No technical jargon, just clear status
132
+ - **Smart alerts** - Warns you at 50%, 75%, and 90% usage
133
+ - **Model breakdown** - See which models are eating your tokens
134
+ - **Project breakdown** - See which projects are using your quota
135
+ - **Usage over time** - Track 5hr window and weekly usage
136
+ - **Contextual guidance** - Smart recommendations based on your usage patterns
137
+ - **Interactive actions** - Press Y/N to execute suggested actions
138
+ - **Zero token cost** - Pacman reads local files, doesn't call the API
139
+
140
+ ## Display Information
141
+
142
+ | Section | Data Shown |
143
+ |---------|------------|
144
+ | **Token Status** | Progress bar + % + tokens used/limit + reset time |
145
+ | **Usage Over Time** | Current session (% + reset time) and Current week (7-day total) |
146
+ | **Breakdown** | By Model and By Project with token counts |
147
+ | **Guidance** | Context-aware recommendation + optional Y/N action |
148
+
149
+ ## Smart Guidance
150
+
151
+ Pacman provides contextual guidance based on your usage:
152
+
153
+ | Condition | Guidance | Action |
154
+ |-----------|----------|--------|
155
+ | ≥90% usage | "You're almost at your limit..." | → Run /compact? [Y/N] |
156
+ | High burn + ≥70% | "Using tokens quickly..." | → Run /compact? [Y/N] |
157
+ | Heavy Opus (>60%) | "Opus is handling X%..." | → Switch to Sonnet? [Y/N] |
158
+ | ≥75% usage | "Running low on tokens..." | → Run /compact? [Y/N] |
159
+ | High burn rate | "High token velocity..." | (informational) |
160
+ | 50-74% usage | "Halfway through..." | (informational) |
161
+ | <50% usage | "You're in good shape." | (none needed) |
162
+
163
+ ## Interactive Actions
164
+
165
+ When a Y/N prompt appears, you can:
166
+ - Press **Y** to execute the suggested command
167
+ - Press **N** to dismiss (won't show again this session)
168
+ - Press **Ctrl+C** to exit
169
+
170
+ ## Token Calculation
171
+
172
+ Pacman correctly calculates **billable tokens** that count toward your rate limit:
173
+
174
+ | Token Type | Counts Toward Limit? |
175
+ |------------|---------------------|
176
+ | Input tokens | Yes |
177
+ | Output tokens | Yes |
178
+ | Cache creation | Yes |
179
+ | Cache reads | **No (FREE)** |
180
+
181
+ This matches how Claude's `/usage` calculates your usage.
182
+
183
+ ## Alerts
184
+
185
+ | Threshold | Color | Alert |
186
+ |-----------|-------|-------|
187
+ | 50% | Yellow | Halfway there |
188
+ | 75% | Orange | Running low |
189
+ | 90% | Red | ALMOST OUT! |
190
+
191
+ ## Requirements
192
+
193
+ - Python 3.9+
194
+ - Claude Code CLI (creates the usage data files in `~/.claude/projects/`)
@@ -0,0 +1,133 @@
1
+ # Pacman Token Manager
2
+
3
+ Tool for monitoring more detail info on token usage in your terminal.
4
+
5
+ ```
6
+ ┌──────────────────────────────────────────────────────────────┐
7
+ │ Pacman Token Manager │
8
+ ├──────────────────────────────────────────────────────────────┤
9
+ │ Halfway there · Resets in 4h 25m (started 10:00 AM) │
10
+ ├──────────────────────────────────────────────────────────────┤
11
+ │ │
12
+ │ TKN █████░░░░░░░░░░░░░░░ 27% 193,920 / 728,474 │
13
+ │ 534k left · Resets in 4h 25m │
14
+ │ │
15
+ ├─ Usage over time ────────────────────────────────────────────┤
16
+ │ │
17
+ │ Period Usage TKN │
18
+ │ Current session ███░░░░░░░░░ 27% 193k │
19
+ │ Resets in 4h 25m │
20
+ │ │
21
+ │ Current week 4.6m │
22
+ │ (7-day rolling total) │
23
+ │ │
24
+ ├─ Breakdown ──────────────────────────────────────────────────┤
25
+ │ │
26
+ │ By Model Usage TKN │
27
+ │ Opus ████████████ 183k │
28
+ │ Sonnet ░░░░░░░░░░░░ 10k │
29
+ │ │
30
+ ├─ Guidance ───────────────────────────────────────────────────┤
31
+ │ │
32
+ │ Opus is handling 75% of your work. Sonnet is often │
33
+ │ sufficient and more economical. │
34
+ │ │
35
+ │ → Switch to Sonnet? [Y]es [N]o thanks │
36
+ │ │
37
+ │ Ctrl+C to exit │
38
+ └──────────────────────────────────────────────────────────────┘
39
+ ```
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ # From PyPI (after publishing)
45
+ pip install pacman-token-manager
46
+
47
+ # Or install from GitHub
48
+ pip install git+https://github.com/tsuimou/pacman-token-manager.git
49
+
50
+ # Or local development
51
+ pip install -e .
52
+ ```
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ # Pick your favorite command
58
+ chomp
59
+ pac
60
+ pacman
61
+ pactkn
62
+ pacman-token-manager
63
+ ```
64
+
65
+ ## Features
66
+
67
+ - **Accurate token tracking** - Counts only billable tokens (excludes free cache reads)
68
+ - **All projects view** - Tracks usage across ALL your Claude Code projects
69
+ - **Matches Claude /usage** - Shows the same percentage as Claude's built-in `/usage`
70
+ - **Human-first design** - No technical jargon, just clear status
71
+ - **Smart alerts** - Warns you at 50%, 75%, and 90% usage
72
+ - **Model breakdown** - See which models are eating your tokens
73
+ - **Project breakdown** - See which projects are using your quota
74
+ - **Usage over time** - Track 5hr window and weekly usage
75
+ - **Contextual guidance** - Smart recommendations based on your usage patterns
76
+ - **Interactive actions** - Press Y/N to execute suggested actions
77
+ - **Zero token cost** - Pacman reads local files, doesn't call the API
78
+
79
+ ## Display Information
80
+
81
+ | Section | Data Shown |
82
+ |---------|------------|
83
+ | **Token Status** | Progress bar + % + tokens used/limit + reset time |
84
+ | **Usage Over Time** | Current session (% + reset time) and Current week (7-day total) |
85
+ | **Breakdown** | By Model and By Project with token counts |
86
+ | **Guidance** | Context-aware recommendation + optional Y/N action |
87
+
88
+ ## Smart Guidance
89
+
90
+ Pacman provides contextual guidance based on your usage:
91
+
92
+ | Condition | Guidance | Action |
93
+ |-----------|----------|--------|
94
+ | ≥90% usage | "You're almost at your limit..." | → Run /compact? [Y/N] |
95
+ | High burn + ≥70% | "Using tokens quickly..." | → Run /compact? [Y/N] |
96
+ | Heavy Opus (>60%) | "Opus is handling X%..." | → Switch to Sonnet? [Y/N] |
97
+ | ≥75% usage | "Running low on tokens..." | → Run /compact? [Y/N] |
98
+ | High burn rate | "High token velocity..." | (informational) |
99
+ | 50-74% usage | "Halfway through..." | (informational) |
100
+ | <50% usage | "You're in good shape." | (none needed) |
101
+
102
+ ## Interactive Actions
103
+
104
+ When a Y/N prompt appears, you can:
105
+ - Press **Y** to execute the suggested command
106
+ - Press **N** to dismiss (won't show again this session)
107
+ - Press **Ctrl+C** to exit
108
+
109
+ ## Token Calculation
110
+
111
+ Pacman correctly calculates **billable tokens** that count toward your rate limit:
112
+
113
+ | Token Type | Counts Toward Limit? |
114
+ |------------|---------------------|
115
+ | Input tokens | Yes |
116
+ | Output tokens | Yes |
117
+ | Cache creation | Yes |
118
+ | Cache reads | **No (FREE)** |
119
+
120
+ This matches how Claude's `/usage` calculates your usage.
121
+
122
+ ## Alerts
123
+
124
+ | Threshold | Color | Alert |
125
+ |-----------|-------|-------|
126
+ | 50% | Yellow | Halfway there |
127
+ | 75% | Orange | Running low |
128
+ | 90% | Red | ALMOST OUT! |
129
+
130
+ ## Requirements
131
+
132
+ - Python 3.9+
133
+ - Claude Code CLI (creates the usage data files in `~/.claude/projects/`)
@@ -0,0 +1,205 @@
1
+ # Automatically refactored pyproject.toml with best practices
2
+
3
+ [build-system]
4
+ requires = ["setuptools>=61.0.0", "wheel"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "pacman-token-manager"
9
+ version = "3.1.0"
10
+ description = "A real-time terminal monitoring tool for Claude Code token usage with advanced analytics and Rich UI"
11
+ readme = "README.md"
12
+ license = { text = "MIT" }
13
+ requires-python = ">=3.9"
14
+ authors = [{ name = "tsuimou" }]
15
+ maintainers = [{ name = "tsuimou" }]
16
+ keywords = [
17
+ "ai", "analytics", "claude", "dashboard",
18
+ "developer-tools", "monitoring", "rich",
19
+ "terminal", "token", "usage"
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 5 - Production/Stable",
23
+ "Environment :: Console",
24
+ "Environment :: Console :: Curses",
25
+ "Intended Audience :: Developers",
26
+ "Topic :: Software Development :: Debuggers",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ "Topic :: System :: Monitoring",
29
+ "Topic :: Terminals",
30
+ "Topic :: Utilities",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "License :: OSI Approved :: MIT License",
34
+ "Operating System :: OS Independent",
35
+ "Operating System :: POSIX :: Linux",
36
+ "Operating System :: MacOS",
37
+ # "Operating System :: Microsoft :: Windows",
38
+ "Typing :: Typed"
39
+ ]
40
+ dependencies = [
41
+ "numpy>=1.21.0",
42
+ "pydantic>=2.0.0",
43
+ "pydantic-settings>=2.0.0",
44
+ "pyyaml>=6.0",
45
+ "pytz>=2023.3",
46
+ "rich>=13.7.0",
47
+ "tomli>=1.2.0; python_version < '3.11'",
48
+ "tzdata; sys_platform == 'win32'"
49
+ ]
50
+
51
+ [project.optional-dependencies]
52
+ dev = [
53
+ "black>=24.0.0",
54
+ "isort>=5.13.0",
55
+ "mypy>=1.13.0",
56
+ "pre-commit>=4.0.0",
57
+ "pytest>=8.0.0",
58
+ "pytest-asyncio>=0.24.0",
59
+ "pytest-benchmark>=4.0.0",
60
+ "pytest-cov>=6.0.0",
61
+ "pytest-mock>=3.14.0",
62
+ "pytest-xdist>=3.6.0",
63
+ "ruff>=0.12.0",
64
+ "build>=0.10.0",
65
+ "twine>=4.0.0"
66
+ ]
67
+ test = [
68
+ "pytest>=8.0.0",
69
+ "pytest-cov>=6.0.0",
70
+ "pytest-mock>=3.14.0",
71
+ "pytest-asyncio>=0.24.0",
72
+ "pytest-benchmark>=4.0.0"
73
+ ]
74
+
75
+
76
+ [project.urls]
77
+ homepage = "https://github.com/tsuimou/pacman-token-manager"
78
+ repository = "https://github.com/tsuimou/pacman-token-manager.git"
79
+ documentation = "https://github.com/tsuimou/pacman-token-manager#readme"
80
+ issues = "https://github.com/tsuimou/pacman-token-manager/issues"
81
+
82
+ [project.scripts]
83
+ pacman-token-manager = "pacman.__main__:main"
84
+ pacman = "pacman.__main__:main"
85
+ pactkn = "pacman.__main__:main"
86
+ chomp = "pacman.__main__:main"
87
+ pac = "pacman.__main__:main"
88
+
89
+ [tool.setuptools.packages.find]
90
+ where = ["src"]
91
+ include = ["pacman*"]
92
+ exclude = ["tests*", "src/tests*"]
93
+
94
+ [tool.setuptools.package-data]
95
+ pacman = ["py.typed"]
96
+
97
+ [tool.black]
98
+ line-length = 88
99
+ target-version = ["py39", "py310", "py311", "py312"]
100
+ skip-string-normalization = false
101
+ include = '\.pyi?$'
102
+ extend-exclude = '''
103
+ /(
104
+ \.eggs
105
+ | \.git
106
+ | \.hg
107
+ | \.tox
108
+ | \.venv
109
+ | build
110
+ | dist
111
+ )/
112
+ '''
113
+
114
+ [tool.isort]
115
+ profile = "black"
116
+ line_length = 88
117
+ known_first_party = ["pacman"]
118
+ force_single_line = true
119
+ atomic = true
120
+ include_trailing_comma = true
121
+ lines_after_imports = 2
122
+ lines_between_types = 1
123
+ use_parentheses = true
124
+ src_paths = ["src"]
125
+ skip_glob = ["*/migrations/*", "*/venv/*", "*/build/*", "*/dist/*"]
126
+
127
+ [tool.ruff]
128
+ line-length = 88
129
+ target-version = "py39"
130
+
131
+ [tool.ruff.lint]
132
+ select = ["E", "W", "F", "I"] # pycodestyle + Pyflakes + isort
133
+ ignore = ["E501"] # Line length handled by formatter
134
+
135
+ [tool.ruff.format]
136
+ quote-style = "double"
137
+
138
+
139
+ [tool.mypy]
140
+ python_version = "3.9"
141
+ warn_return_any = true # Catch unintended Any returns
142
+ warn_no_return = true # Ensure functions return as expected
143
+ strict_optional = true # Disallow None where not annotated
144
+
145
+ disable_error_code = [
146
+ "attr-defined", # Attribute existence
147
+ "name-defined", # Name resolution
148
+ "import", # Import errors
149
+ "misc", # Misc issues
150
+ ]
151
+
152
+ [tool.pytest.ini_options]
153
+ minversion = "7.0"
154
+ testpaths = ["src/tests"]
155
+ python_files = ["test_*.py","*_test.py"]
156
+ python_classes = ["Test*"]
157
+ python_functions = ["test_*"]
158
+ addopts = [
159
+ "--strict-markers","--strict-config","--color=yes","--tb=short",
160
+ "--cov=pacman","--cov-report=term-missing","--cov-report=html",
161
+ "--cov-report=xml","--cov-fail-under=70","--no-cov-on-fail","-ra","-q",
162
+ "-m","not integration"
163
+ ]
164
+ markers = [
165
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')",
166
+ "unit: marks tests as unit tests",
167
+ "integration: marks tests as integration tests",
168
+ "benchmark: marks tests as benchmarks",
169
+ "network: marks tests as requiring network access",
170
+ "subprocess: marks tests as requiring subprocess"
171
+ ]
172
+ filterwarnings = [
173
+ "error",
174
+ "ignore::UserWarning",
175
+ "ignore::DeprecationWarning",
176
+ "ignore::PendingDeprecationWarning"
177
+ ]
178
+
179
+ [tool.coverage.run]
180
+ branch = true
181
+ source = ["src/pacman"]
182
+ omit = ["*/tests/*","*/test_*","*/__main__.py","*/conftest.py"]
183
+
184
+ [tool.coverage.report]
185
+ exclude_lines = [
186
+ "pragma: no cover",
187
+ "def __repr__",
188
+ "if self.debug:",
189
+ "if settings.DEBUG",
190
+ "raise AssertionError",
191
+ "raise NotImplementedError",
192
+ "if 0:",
193
+ "if __name__ == .__main__.:",
194
+ "class .*\\bProtocol\\):",
195
+ "@(abc\\.)?abstractmethod"
196
+ ]
197
+ show_missing = true
198
+ skip_empty = false
199
+ precision = 2
200
+
201
+ [tool.coverage.html]
202
+ directory = "htmlcov"
203
+
204
+ [tool.coverage.xml]
205
+ output = "coverage.xml"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Claude Monitor - Real-time token usage monitoring for Claude AI"""
2
+
3
+ from pacman._version import __version__
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env python3
2
+ """Module execution entry point for Claude Monitor.
3
+
4
+ Allows running the package as a module: python -m pacman
5
+ """
6
+
7
+ import sys
8
+ from typing import NoReturn
9
+
10
+ from .cli.main import main
11
+
12
+
13
+ def _main() -> NoReturn:
14
+ """Entry point that properly handles exit codes and never returns."""
15
+ exit_code = main()
16
+ sys.exit(exit_code)
17
+
18
+
19
+ if __name__ == "__main__":
20
+ _main()