-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_report.py
More file actions
52 lines (44 loc) · 1.43 KB
/
generate_report.py
File metadata and controls
52 lines (44 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
"""
Generate periodic Moonshot usage reports
Usage: python generate_report.py [daily|weekly|monthly]
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from moonshot_tracker import MoonshotUsageTracker
def main():
if len(sys.argv) < 2:
print("Usage: python generate_report.py [daily|weekly|monthly]")
sys.exit(1)
report_type = sys.argv[1].lower()
tracker = MoonshotUsageTracker()
if report_type == "daily":
days = 1
report = tracker.get_daily_report(1)
elif report_type == "weekly":
days = 7
report = tracker.get_weekly_report()
elif report_type == "monthly":
days = 30
report = tracker.get_monthly_report()
else:
print(f"Unknown report type: {report_type}")
print("Use: daily, weekly, or monthly")
sys.exit(1)
# Save to Obsidian
report_path = tracker.save_report_to_obsidian(days)
# Print summary
print(f"\n{'='*60}")
print(f"MOONSHOT {report_type.upper()} USAGE REPORT")
print(f"{'='*60}")
print(f"\nPeriod: {report['period']}")
print(f"Sessions: {report['sessions_count']}")
print(f"Total Tokens: {report['total_tokens']:,}")
print(f"Cost: {report['cost_formatted']}")
print(f"\n{'='*60}")
print(f"Full report saved to:")
print(f" {report_path}")
print(f"{'='*60}\n")
if __name__ == "__main__":
main()