artificial-intelligence-usage 0.0.2__tar.gz → 0.0.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.
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/PKG-INFO +1 -2
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/README.md +0 -1
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/pyproject.toml +1 -1
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.egg-info/PKG-INFO +1 -2
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.py +1 -10
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/tests/test_artificial_intelligence_usage.py +1 -27
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/setup.cfg +0 -0
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.egg-info/SOURCES.txt +0 -0
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.egg-info/dependency_links.txt +0 -0
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.egg-info/entry_points.txt +0 -0
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/src/artificial_intelligence_usage.egg-info/top_level.txt +0 -0
- {artificial_intelligence_usage-0.0.2 → artificial_intelligence_usage-0.0.3}/tests/test_publish_pypi.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: artificial-intelligence-usage
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Analyze usage of artificial intelligence tool.
|
|
5
5
|
Author: Kaizten Analytics
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -17,7 +17,6 @@ latest session followed by daily session, turn, token, and rate-limit usage.
|
|
|
17
17
|
## Behavior
|
|
18
18
|
|
|
19
19
|
- Reads rollout files below `~/.codex/sessions`.
|
|
20
|
-
- Reports when the Codex or Claude CLI is not available on `PATH`.
|
|
21
20
|
- Shows status details from the most recently modified session.
|
|
22
21
|
- Reports sessions from the last 14 calendar days by default, including today.
|
|
23
22
|
- Counts user turns and cumulative tokens for each session.
|
|
@@ -6,7 +6,6 @@ latest session followed by daily session, turn, token, and rate-limit usage.
|
|
|
6
6
|
## Behavior
|
|
7
7
|
|
|
8
8
|
- Reads rollout files below `~/.codex/sessions`.
|
|
9
|
-
- Reports when the Codex or Claude CLI is not available on `PATH`.
|
|
10
9
|
- Shows status details from the most recently modified session.
|
|
11
10
|
- Reports sessions from the last 14 calendar days by default, including today.
|
|
12
11
|
- Counts user turns and cumulative tokens for each session.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: artificial-intelligence-usage
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Analyze usage of artificial intelligence tool.
|
|
5
5
|
Author: Kaizten Analytics
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -17,7 +17,6 @@ latest session followed by daily session, turn, token, and rate-limit usage.
|
|
|
17
17
|
## Behavior
|
|
18
18
|
|
|
19
19
|
- Reads rollout files below `~/.codex/sessions`.
|
|
20
|
-
- Reports when the Codex or Claude CLI is not available on `PATH`.
|
|
21
20
|
- Shows status details from the most recently modified session.
|
|
22
21
|
- Reports sessions from the last 14 calendar days by default, including today.
|
|
23
22
|
- Counts user turns and cumulative tokens for each session.
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""Analyze recent Codex
|
|
2
|
+
"""Analyze recent sessions of artificial intelligence tools (Codex, Claude, etc.) and report usage information."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
import argparse
|
|
7
7
|
import json
|
|
8
|
-
import shutil
|
|
9
8
|
from collections import Counter, defaultdict
|
|
10
9
|
from datetime import date, datetime, timedelta
|
|
11
10
|
from pathlib import Path
|
|
@@ -15,13 +14,6 @@ from typing import Any
|
|
|
15
14
|
DEFAULT_DAYS = 14
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
def print_unavailable_tools() -> None:
|
|
19
|
-
"""Print a message for each supported AI CLI that is not on PATH."""
|
|
20
|
-
for command, name in (("codex", "Codex"), ("claude", "Claude")):
|
|
21
|
-
if shutil.which(command) is None:
|
|
22
|
-
print(f"{name} is not available.")
|
|
23
|
-
|
|
24
|
-
|
|
25
17
|
def positive_int(value: str) -> int:
|
|
26
18
|
"""Return value as a positive integer for command-line arguments."""
|
|
27
19
|
try:
|
|
@@ -360,7 +352,6 @@ def run_report(sessions_dir: Path, days: int, today: date | None = None) -> int:
|
|
|
360
352
|
def main(argv: list[str] | None = None) -> int:
|
|
361
353
|
"""Run the artificial-intelligence-usage command."""
|
|
362
354
|
args = build_parser().parse_args(argv)
|
|
363
|
-
print_unavailable_tools()
|
|
364
355
|
return run_report(Path.home() / ".codex" / "sessions", args.days)
|
|
365
356
|
|
|
366
357
|
|
|
@@ -184,40 +184,14 @@ class ArtificialIntelligenceUsageTests(unittest.TestCase):
|
|
|
184
184
|
def test_main_can_be_called_repeatedly(self):
|
|
185
185
|
with patch.object(
|
|
186
186
|
artificial_intelligence_usage, "run_report", return_value=0
|
|
187
|
-
) as run_report
|
|
188
|
-
artificial_intelligence_usage, "print_unavailable_tools"
|
|
189
|
-
) as print_unavailable_tools:
|
|
187
|
+
) as run_report:
|
|
190
188
|
self.assertEqual(artificial_intelligence_usage.main(["--days", "3"]), 0)
|
|
191
189
|
self.assertEqual(artificial_intelligence_usage.main(["--days", "5"]), 0)
|
|
192
190
|
|
|
193
191
|
self.assertEqual(run_report.call_count, 2)
|
|
194
|
-
self.assertEqual(print_unavailable_tools.call_count, 2)
|
|
195
192
|
self.assertEqual(run_report.call_args_list[0].args[1], 3)
|
|
196
193
|
self.assertEqual(run_report.call_args_list[1].args[1], 5)
|
|
197
194
|
|
|
198
|
-
def test_unavailable_tools_prints_a_message_for_codex_and_claude(self):
|
|
199
|
-
output = io.StringIO()
|
|
200
|
-
with patch.object(
|
|
201
|
-
artificial_intelligence_usage.shutil, "which", return_value=None
|
|
202
|
-
), contextlib.redirect_stdout(output):
|
|
203
|
-
artificial_intelligence_usage.print_unavailable_tools()
|
|
204
|
-
|
|
205
|
-
self.assertEqual(
|
|
206
|
-
output.getvalue(),
|
|
207
|
-
"Codex is not available.\nClaude is not available.\n",
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
def test_unavailable_tools_does_not_print_for_installed_commands(self):
|
|
211
|
-
output = io.StringIO()
|
|
212
|
-
with patch.object(
|
|
213
|
-
artificial_intelligence_usage.shutil,
|
|
214
|
-
"which",
|
|
215
|
-
side_effect=lambda command: f"/usr/bin/{command}",
|
|
216
|
-
), contextlib.redirect_stdout(output):
|
|
217
|
-
artificial_intelligence_usage.print_unavailable_tools()
|
|
218
|
-
|
|
219
|
-
self.assertEqual(output.getvalue(), "")
|
|
220
|
-
|
|
221
195
|
|
|
222
196
|
if __name__ == "__main__":
|
|
223
197
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|