Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "spending-tracker",
|
||||
"description": "Track Claude Code API spending with daily and hourly breakdowns",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Fucheng Warren Zhu",
|
||||
"email": "wzhu@college.harvard.edu"
|
||||
},
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# spending-tracker
|
||||
|
||||
Track Claude Code API spending with daily and hourly breakdowns
|
||||
32
commands/spending-get.md
Normal file
32
commands/spending-get.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
description: Get current spending totals (daily, weekly, and hourly)
|
||||
---
|
||||
|
||||
# Get Spending Totals
|
||||
|
||||
Display current spending totals for today, this week, and the current hour.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Execute command**:
|
||||
- Run: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/track_spending.py --data-dir ${CLAUDE_PLUGIN_ROOT}/spending_data get --format text`
|
||||
- Display the daily, weekly, and hourly spending totals
|
||||
|
||||
2. **Format output**:
|
||||
- Show daily total with date
|
||||
- Show weekly total with week number
|
||||
- Show hourly total with time period
|
||||
- Use clear formatting for easy reading
|
||||
|
||||
## Example Output
|
||||
|
||||
```
|
||||
Daily: $5.25
|
||||
Weekly: $32.40
|
||||
Hourly: $1.32
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- No confirmation needed (read-only operation)
|
||||
- Data is read from `${CLAUDE_PLUGIN_ROOT}/spending_data/`
|
||||
45
commands/spending-reset.md
Normal file
45
commands/spending-reset.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
description: Reset all spending tracking data
|
||||
---
|
||||
|
||||
# Reset Spending Data
|
||||
|
||||
Reset all spending tracking data (daily, weekly, and hourly). This operation is destructive and cannot be undone.
|
||||
|
||||
## Arguments
|
||||
|
||||
Input: `$ARGUMENTS`
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Parse arguments**:
|
||||
- Check if `--confirm` or `-f` flag is present in `$ARGUMENTS`
|
||||
|
||||
2. **Ask for confirmation** (UNLESS `--confirm` or `-f` flag is present):
|
||||
- Warn user: "⚠️ This will delete ALL spending tracking data (daily, weekly, and hourly). This cannot be undone."
|
||||
- Show affected files:
|
||||
- `${CLAUDE_PLUGIN_ROOT}/spending_data/daily.json`
|
||||
- `${CLAUDE_PLUGIN_ROOT}/spending_data/weekly.json`
|
||||
- `${CLAUDE_PLUGIN_ROOT}/spending_data/hourly.json`
|
||||
- `${CLAUDE_PLUGIN_ROOT}/spending_data/session_state.json`
|
||||
- Ask: "Are you sure you want to proceed? (yes/no)"
|
||||
- If user responds "no" or anything other than "yes", abort
|
||||
- If user responds "yes", proceed
|
||||
|
||||
3. **Execute reset**:
|
||||
- Run: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/track_spending.py --data-dir ${CLAUDE_PLUGIN_ROOT}/spending_data reset --confirm`
|
||||
- Display success message
|
||||
|
||||
## Example Usage
|
||||
|
||||
```
|
||||
/spending-reset
|
||||
/spending-reset --confirm
|
||||
/spending-reset -f
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- ALWAYS ask for confirmation unless `--confirm` or `-f` is provided
|
||||
- This operation is irreversible
|
||||
- Session state will also be cleared
|
||||
46
commands/spending-stats.md
Normal file
46
commands/spending-stats.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
description: Show detailed spending statistics
|
||||
---
|
||||
|
||||
# Spending Statistics
|
||||
|
||||
Display detailed statistics about your Claude Code API spending, including historical data and averages.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Execute command**:
|
||||
- Run: `python3 ${CLAUDE_PLUGIN_ROOT}/scripts/track_spending.py --data-dir ${CLAUDE_PLUGIN_ROOT}/spending_data stats`
|
||||
- Display the full statistics output
|
||||
|
||||
2. **Show information**:
|
||||
- Total days tracked
|
||||
- Total spending across all days
|
||||
- Average spending per day
|
||||
- Total hours tracked
|
||||
- Average spending per hour
|
||||
- Current day and hour totals
|
||||
|
||||
## Example Output
|
||||
|
||||
```
|
||||
=== Spending Statistics ===
|
||||
|
||||
Daily Tracking:
|
||||
Total days tracked: 15
|
||||
Total across all days: $123.45
|
||||
Average per day: $8.23
|
||||
|
||||
Hourly Tracking:
|
||||
Total hours tracked: 89
|
||||
Total across all hours: $123.45
|
||||
Average per hour: $1.39
|
||||
|
||||
Current Period:
|
||||
Today (2025-10-10): $12.34
|
||||
This hour (2025-10-10T12:00): $2.45
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- No confirmation needed (read-only operation)
|
||||
- Historical data is kept for 30 days by default
|
||||
53
plugin.lock.json
Normal file
53
plugin.lock.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:WarrenZhu050413/Warren-Claude-Code-Plugin-Marketplace:spending-tracker-plugin",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "5dc8bd366bf018f4ec1d6ba5bf12a3705ebde996",
|
||||
"treeHash": "c2e3baed87f7eb93773a37c1225ab67cf5fd7054acf56ca13b94e1c1a53dc5ed",
|
||||
"generatedAt": "2025-11-28T10:12:56.509103Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "spending-tracker",
|
||||
"description": "Track Claude Code API spending with daily and hourly breakdowns",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "f018f2f880c820dfc40edd506620a14ed570f6d0cb8367a7f8869e3f041324ab"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "29d9cac8174ab8434fd15c3ba7d61cdcbaa41ca3170fd1ee1db330f924c3c45a"
|
||||
},
|
||||
{
|
||||
"path": "commands/spending-get.md",
|
||||
"sha256": "75e44ab5729f7ea55dbc3a2db344602f5a96b9d1e6c653585080d688c668face"
|
||||
},
|
||||
{
|
||||
"path": "commands/spending-reset.md",
|
||||
"sha256": "b8a848ba22519c0e3a67cb89d61aec97b912d5a1ea2c33637bcc3515fad4336d"
|
||||
},
|
||||
{
|
||||
"path": "commands/spending-stats.md",
|
||||
"sha256": "f0d1abde72233cb2003926f5f9ea39f6ac265532f5bb39f3be274c5c0ca73171"
|
||||
}
|
||||
],
|
||||
"dirSha256": "c2e3baed87f7eb93773a37c1225ab67cf5fd7054acf56ca13b94e1c1a53dc5ed"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user