clawculator 2.8.1 → 2.8.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/README.md +44 -3
- package/bin/clawculator.js +16 -0
- package/package.json +1 -1
- package/skills/clawculator/snapshotCard.js +46 -10
- package/src/snapshotCard.js +46 -10
package/README.md
CHANGED
|
@@ -25,11 +25,10 @@ It could be any of these. Clawculator finds all of them — with zero AI, zero g
|
|
|
25
25
|
## Quick start
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx clawculator --
|
|
28
|
+
npx clawculator --snapshot # Get your cost grade — screenshot & share
|
|
29
|
+
npx clawculator --web # Browser dashboard at localhost:3457
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
That's it. Pin the tab. Watch your costs in real-time while you work.
|
|
32
|
-
|
|
33
32
|
---
|
|
34
33
|
|
|
35
34
|
## [▶ Live Demo](https://echoudhry.github.io/clawculator)
|
|
@@ -48,6 +47,41 @@ The dashboard features a Pac-Man-style lobster claw that chomps across the heade
|
|
|
48
47
|
|
|
49
48
|
## Modes
|
|
50
49
|
|
|
50
|
+
### `--snapshot` — Shareable Grade Card (new in v2.8)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx clawculator --snapshot
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Grades your setup **A+ to D**, shows your daily cost range, and displays your setup complexity — all in a screenshot-ready terminal card. No exact dollar amounts or session names are exposed. Built for sharing.
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
╔══════════════════════════════════════════════╗
|
|
60
|
+
║ ║
|
|
61
|
+
║ 🦞 C L A W C U L A T O R ║
|
|
62
|
+
║ ║
|
|
63
|
+
║ ┌─────────┐ ║
|
|
64
|
+
║ │ A+ │ ║
|
|
65
|
+
║ └─────────┘ ║
|
|
66
|
+
║ cost health grade ║
|
|
67
|
+
║ ║
|
|
68
|
+
║ 💲 Under $1/day ║
|
|
69
|
+
║ ║
|
|
70
|
+
║ 📱 2 channels 🔧 4 skills ⏰ 1 cron ║
|
|
71
|
+
║ 💬 6 sessions 🧠 2 models ⚡ 85% cache ║
|
|
72
|
+
║ ║
|
|
73
|
+
║ ✅ No issues found ║
|
|
74
|
+
║ ║
|
|
75
|
+
║ Get your OpenClaw cost grade ║
|
|
76
|
+
║ npx clawculator --snapshot ║
|
|
77
|
+
║ ║
|
|
78
|
+
╚══════════════════════════════════════════════╝
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Screenshot it. Post it. What's your grade?
|
|
82
|
+
|
|
83
|
+
Also works as an OpenClaw skill — type `snapshot` or `what's my grade` in any channel.
|
|
84
|
+
|
|
51
85
|
### `--web` — Browser Dashboard (new in v2.6)
|
|
52
86
|
|
|
53
87
|
```bash
|
|
@@ -151,12 +185,14 @@ The `--web` and `--live` modes watch these files in real-time, tailing new lines
|
|
|
151
185
|
|
|
152
186
|
```bash
|
|
153
187
|
npx clawculator # Terminal analysis (default)
|
|
188
|
+
npx clawculator --snapshot # Shareable grade card (screenshot & post!)
|
|
154
189
|
npx clawculator --web # Browser dashboard (localhost:3457)
|
|
155
190
|
npx clawculator --web --port=8080 # Custom port
|
|
156
191
|
npx clawculator --live # Real-time terminal dashboard
|
|
157
192
|
npx clawculator --report # Visual HTML report
|
|
158
193
|
npx clawculator --md # Markdown report
|
|
159
194
|
npx clawculator --json # JSON for piping
|
|
195
|
+
npx clawculator --prune # Clean up SQLite database
|
|
160
196
|
npx clawculator --md --out=~/cost.md # Custom output path
|
|
161
197
|
npx clawculator --config=/path/to/openclaw.json
|
|
162
198
|
npx clawculator --help
|
|
@@ -181,6 +217,11 @@ clawculator
|
|
|
181
217
|
|
|
182
218
|
Your agent runs the analysis and returns the full markdown report directly in chat.
|
|
183
219
|
|
|
220
|
+
For the shareable grade card, type:
|
|
221
|
+
```
|
|
222
|
+
snapshot
|
|
223
|
+
```
|
|
224
|
+
|
|
184
225
|
**Or install manually** into your workspace:
|
|
185
226
|
```bash
|
|
186
227
|
mkdir -p ~/clawd/skills/clawculator
|
package/bin/clawculator.js
CHANGED
|
@@ -16,6 +16,7 @@ const flags = {
|
|
|
16
16
|
live: args.includes('--live'),
|
|
17
17
|
web: args.includes('--web'),
|
|
18
18
|
prune: args.includes('--prune'),
|
|
19
|
+
snapshot: args.includes('--snapshot'),
|
|
19
20
|
help: args.includes('--help') || args.includes('-h'),
|
|
20
21
|
config: args.find(a => a.startsWith('--config='))?.split('=')[1],
|
|
21
22
|
out: args.find(a => a.startsWith('--out='))?.split('=')[1],
|
|
@@ -43,6 +44,7 @@ Options:
|
|
|
43
44
|
--live Real-time cost dashboard in terminal (great for tmux)
|
|
44
45
|
--web Browser dashboard at localhost:3457 (pin the tab!)
|
|
45
46
|
--report Generate HTML report and open in browser
|
|
47
|
+
--snapshot Generate a shareable cost snapshot card (screenshot & post!)
|
|
46
48
|
--md Save markdown report to ./clawculator-report.md
|
|
47
49
|
--json Output raw JSON
|
|
48
50
|
--out=PATH Custom output path for --md or --report
|
|
@@ -54,6 +56,7 @@ Options:
|
|
|
54
56
|
Examples:
|
|
55
57
|
npx clawculator # Terminal analysis
|
|
56
58
|
npx clawculator --web # Browser dashboard (localhost:3457)
|
|
59
|
+
npx clawculator --snapshot # Shareable cost card (screenshot & post!)
|
|
57
60
|
npx clawculator --live # Real-time terminal dashboard
|
|
58
61
|
npx clawculator --md # Markdown report (readable by your AI agent)
|
|
59
62
|
npx clawculator --report # Visual HTML dashboard
|
|
@@ -164,6 +167,19 @@ async function main() {
|
|
|
164
167
|
process.exit(0);
|
|
165
168
|
}
|
|
166
169
|
|
|
170
|
+
if (flags.snapshot) {
|
|
171
|
+
const outDir = flags.out || process.cwd();
|
|
172
|
+
const { generateSnapshotCard } = require('../src/snapshotCard');
|
|
173
|
+
const result = generateSnapshotCard(analysis, outDir);
|
|
174
|
+
const { exec } = require('child_process');
|
|
175
|
+
exec(`open "${result.htmlPath}" 2>/dev/null || xdg-open "${result.htmlPath}" 2>/dev/null`, () => {
|
|
176
|
+
process.exit(0);
|
|
177
|
+
});
|
|
178
|
+
// Don't exit immediately — give exec time to open browser
|
|
179
|
+
setTimeout(() => process.exit(0), 2000);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
167
183
|
generateTerminalReport(analysis);
|
|
168
184
|
console.log('\x1b[90m────────────────────────────────────────────────────\x1b[0m');
|
|
169
185
|
console.log('\x1b[36mClawculator\x1b[0m · github.com/echoudhry/clawculator · Your friendly penny pincher.');
|
package/package.json
CHANGED
|
@@ -307,16 +307,52 @@ function generateSnapshotCard(analysis, outputDir) {
|
|
|
307
307
|
const htmlPath = path.join(outputDir, 'clawculator-snapshot.html');
|
|
308
308
|
fs.writeFileSync(htmlPath, html, 'utf8');
|
|
309
309
|
|
|
310
|
-
// Terminal
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
310
|
+
// ── Terminal card (screenshot-ready) ───────────────────
|
|
311
|
+
const C = '\x1b[36m'; // cyan
|
|
312
|
+
const G = gradeColor === '#22c55e' ? '\x1b[32m' : gradeColor === '#f59e0b' ? '\x1b[33m' : gradeColor === '#f97316' ? '\x1b[33m' : '\x1b[31m';
|
|
313
|
+
const D = '\x1b[90m'; // dim
|
|
314
|
+
const B = '\x1b[1m'; // bold
|
|
315
|
+
const R = '\x1b[0m'; // reset
|
|
316
|
+
const W = '\x1b[37m'; // white
|
|
317
|
+
|
|
318
|
+
const pillStr = pills.map(p => `${p.icon} ${p.label}`).join(' ');
|
|
319
|
+
const findStr = findingSummary.length > 0
|
|
320
|
+
? findingSummary.join(' ')
|
|
321
|
+
: '✅ No issues found';
|
|
322
|
+
|
|
323
|
+
const lines = [
|
|
324
|
+
``,
|
|
325
|
+
`${D} ╔══════════════════════════════════════════════╗${R}`,
|
|
326
|
+
`${D} ║${R} ${D}║${R}`,
|
|
327
|
+
`${D} ║${R} ${C}🦞 C L A W C U L A T O R${R} ${D}║${R}`,
|
|
328
|
+
`${D} ║${R} ${D}║${R}`,
|
|
329
|
+
`${D} ║${R} ${G}${B}┌─────────┐${R} ${D}║${R}`,
|
|
330
|
+
`${D} ║${R} ${G}${B}│ ${grade.padStart(3)} │${R} ${D}║${R}`,
|
|
331
|
+
`${D} ║${R} ${G}${B}└─────────┘${R} ${D}║${R}`,
|
|
332
|
+
`${D} ║${R} ${D}cost health grade${R} ${D}║${R}`,
|
|
333
|
+
`${D} ║${R} ${D}║${R}`,
|
|
334
|
+
`${D} ║${R} ${W}${B}${costEmoji} ${costRange}${R}`,
|
|
335
|
+
`${D} ║${R} ${D}║${R}`,
|
|
336
|
+
`${D} ║${R} ${D}──────────────────────────────────────────${R} ${D}║${R}`,
|
|
337
|
+
`${D} ║${R} ${D}║${R}`,
|
|
338
|
+
`${D} ║${R} ${pillStr}`,
|
|
339
|
+
`${D} ║${R} ${D}║${R}`,
|
|
340
|
+
`${D} ║${R} ${findStr}`,
|
|
341
|
+
`${D} ║${R} ${D}║${R}`,
|
|
342
|
+
`${D} ║${R} ${D}──────────────────────────────────────────${R} ${D}║${R}`,
|
|
343
|
+
`${D} ║${R} ${D}║${R}`,
|
|
344
|
+
`${D} ║${R} ${D}Get your OpenClaw cost grade${R} ${D}║${R}`,
|
|
345
|
+
`${D} ║${R} ${C}${B}npx clawculator --snapshot${R} ${D}║${R}`,
|
|
346
|
+
`${D} ║${R} ${D}║${R}`,
|
|
347
|
+
`${D} ╚══════════════════════════════════════════════╝${R}`,
|
|
348
|
+
``,
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
console.log(lines.join('\n'));
|
|
352
|
+
|
|
353
|
+
// Also mention the HTML file
|
|
354
|
+
console.log(` ${D}HTML card saved: ${htmlPath}${R}`);
|
|
355
|
+
console.log(` ${D}Screenshot this terminal or open the HTML — both work!${R}\n`);
|
|
320
356
|
|
|
321
357
|
return { htmlPath, grade, costRange };
|
|
322
358
|
}
|
package/src/snapshotCard.js
CHANGED
|
@@ -307,16 +307,52 @@ function generateSnapshotCard(analysis, outputDir) {
|
|
|
307
307
|
const htmlPath = path.join(outputDir, 'clawculator-snapshot.html');
|
|
308
308
|
fs.writeFileSync(htmlPath, html, 'utf8');
|
|
309
309
|
|
|
310
|
-
// Terminal
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
310
|
+
// ── Terminal card (screenshot-ready) ───────────────────
|
|
311
|
+
const C = '\x1b[36m'; // cyan
|
|
312
|
+
const G = gradeColor === '#22c55e' ? '\x1b[32m' : gradeColor === '#f59e0b' ? '\x1b[33m' : gradeColor === '#f97316' ? '\x1b[33m' : '\x1b[31m';
|
|
313
|
+
const D = '\x1b[90m'; // dim
|
|
314
|
+
const B = '\x1b[1m'; // bold
|
|
315
|
+
const R = '\x1b[0m'; // reset
|
|
316
|
+
const W = '\x1b[37m'; // white
|
|
317
|
+
|
|
318
|
+
const pillStr = pills.map(p => `${p.icon} ${p.label}`).join(' ');
|
|
319
|
+
const findStr = findingSummary.length > 0
|
|
320
|
+
? findingSummary.join(' ')
|
|
321
|
+
: '✅ No issues found';
|
|
322
|
+
|
|
323
|
+
const lines = [
|
|
324
|
+
``,
|
|
325
|
+
`${D} ╔══════════════════════════════════════════════╗${R}`,
|
|
326
|
+
`${D} ║${R} ${D}║${R}`,
|
|
327
|
+
`${D} ║${R} ${C}🦞 C L A W C U L A T O R${R} ${D}║${R}`,
|
|
328
|
+
`${D} ║${R} ${D}║${R}`,
|
|
329
|
+
`${D} ║${R} ${G}${B}┌─────────┐${R} ${D}║${R}`,
|
|
330
|
+
`${D} ║${R} ${G}${B}│ ${grade.padStart(3)} │${R} ${D}║${R}`,
|
|
331
|
+
`${D} ║${R} ${G}${B}└─────────┘${R} ${D}║${R}`,
|
|
332
|
+
`${D} ║${R} ${D}cost health grade${R} ${D}║${R}`,
|
|
333
|
+
`${D} ║${R} ${D}║${R}`,
|
|
334
|
+
`${D} ║${R} ${W}${B}${costEmoji} ${costRange}${R}`,
|
|
335
|
+
`${D} ║${R} ${D}║${R}`,
|
|
336
|
+
`${D} ║${R} ${D}──────────────────────────────────────────${R} ${D}║${R}`,
|
|
337
|
+
`${D} ║${R} ${D}║${R}`,
|
|
338
|
+
`${D} ║${R} ${pillStr}`,
|
|
339
|
+
`${D} ║${R} ${D}║${R}`,
|
|
340
|
+
`${D} ║${R} ${findStr}`,
|
|
341
|
+
`${D} ║${R} ${D}║${R}`,
|
|
342
|
+
`${D} ║${R} ${D}──────────────────────────────────────────${R} ${D}║${R}`,
|
|
343
|
+
`${D} ║${R} ${D}║${R}`,
|
|
344
|
+
`${D} ║${R} ${D}Get your OpenClaw cost grade${R} ${D}║${R}`,
|
|
345
|
+
`${D} ║${R} ${C}${B}npx clawculator --snapshot${R} ${D}║${R}`,
|
|
346
|
+
`${D} ║${R} ${D}║${R}`,
|
|
347
|
+
`${D} ╚══════════════════════════════════════════════╝${R}`,
|
|
348
|
+
``,
|
|
349
|
+
];
|
|
350
|
+
|
|
351
|
+
console.log(lines.join('\n'));
|
|
352
|
+
|
|
353
|
+
// Also mention the HTML file
|
|
354
|
+
console.log(` ${D}HTML card saved: ${htmlPath}${R}`);
|
|
355
|
+
console.log(` ${D}Screenshot this terminal or open the HTML — both work!${R}\n`);
|
|
320
356
|
|
|
321
357
|
return { htmlPath, grade, costRange };
|
|
322
358
|
}
|