cctotals 1.0.1 → 1.0.2
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.
- package/.github/workflows/publish.yml +29 -3
- package/README.md +67 -0
- package/package.json +1 -1
|
@@ -9,17 +9,43 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
11
|
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
fetch-depth: 0
|
|
12
14
|
|
|
13
15
|
- uses: actions/setup-node@v4
|
|
14
16
|
with:
|
|
15
17
|
node-version: '20'
|
|
16
18
|
registry-url: 'https://registry.npmjs.org'
|
|
17
19
|
|
|
18
|
-
- name:
|
|
20
|
+
- name: Setup git and npm
|
|
19
21
|
run: |
|
|
22
|
+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
23
|
+
git config --local user.name "github-actions[bot]"
|
|
20
24
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
|
21
25
|
npm install -g npm
|
|
22
|
-
npm version patch --git-tag-version=false
|
|
23
|
-
npm publish --access public
|
|
24
26
|
env:
|
|
25
27
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
28
|
+
|
|
29
|
+
- name: Get latest npm version
|
|
30
|
+
id: npm_version
|
|
31
|
+
run: |
|
|
32
|
+
LATEST=$(npm view cctotals version 2>/dev/null || echo "0.0.0")
|
|
33
|
+
echo "latest=$LATEST" >> $GITHUB_OUTPUT
|
|
34
|
+
|
|
35
|
+
- name: Bump and publish
|
|
36
|
+
run: |
|
|
37
|
+
CURRENT=$(node -p "require('./package.json').version")
|
|
38
|
+
NPM_LATEST=${{ steps.npm_version.outputs.latest }}
|
|
39
|
+
|
|
40
|
+
echo "Package version: $CURRENT, npm latest: $NPM_LATEST"
|
|
41
|
+
|
|
42
|
+
# Check if npm already has this version
|
|
43
|
+
if npm view cctotals@$CURRENT version &>/dev/null; then
|
|
44
|
+
echo "Version $CURRENT exists on npm, bumping..."
|
|
45
|
+
npm version patch
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
49
|
+
echo "Publishing $NEW_VERSION..."
|
|
50
|
+
git push origin HEAD:main --tags
|
|
51
|
+
npm publish --access public
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# cctotals
|
|
2
|
+
|
|
3
|
+
📊 Analyze and visualize your Claude Code token usage with beautiful weekly graphs in the terminal.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun x cctotals
|
|
9
|
+
# or
|
|
10
|
+
npx cctotals
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- 📈 Weekly token totals bar chart
|
|
16
|
+
- 🤖 Breakdown by model (Sonnet, Haiku, etc.)
|
|
17
|
+
- 🎨 Colorful terminal output
|
|
18
|
+
- 📊 Statistics: total, average, per-week data
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g cctotals
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cctotals
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Output Example
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
══════════════════════════════════════════════════════════════════════
|
|
36
|
+
WEEKLY TOKEN USAGE GRAPH
|
|
37
|
+
══════════════════════════════════════════════════════════════════════
|
|
38
|
+
|
|
39
|
+
Week Start | Tokens (scaled)
|
|
40
|
+
────────────┼────────────────────────────────────────────────────────────
|
|
41
|
+
2026-02-23 │███████████████████████████████████████████████████████████ 2,382,993
|
|
42
|
+
2026-03-02 │█ 15,378
|
|
43
|
+
────────────┼────────────────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
Total: 2,398,371 tokens across 2 weeks
|
|
46
|
+
Average: 1,199,186 tokens/week
|
|
47
|
+
|
|
48
|
+
══════════════════════════════════════════════════════════════════════
|
|
49
|
+
|
|
50
|
+
DETAILED BREAKDOWN BY MODEL
|
|
51
|
+
──────────────────────────────────────────────────
|
|
52
|
+
claude-sonnet-4-6 1,327,999 (55.4%)
|
|
53
|
+
claude-haiku-4-5-20251001 1,070,372 (44.6%)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## How It Works
|
|
57
|
+
|
|
58
|
+
Reads from Claude Code's telemetry data at `~/.claude/stats-cache.json` and aggregates token usage by week.
|
|
59
|
+
|
|
60
|
+
## Requirements
|
|
61
|
+
|
|
62
|
+
- Node.js 18+ or Bun
|
|
63
|
+
- Claude Code with telemetry enabled
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|