cchubber 0.3.4 → 0.3.5
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/package.json +1 -1
- package/src/cli/index.js +7 -3
- package/src/renderers/terminal-summary.js +48 -15
- package/src/telemetry.js +1 -1
package/package.json
CHANGED
package/src/cli/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const flags = {
|
|
|
41
41
|
if (flags.help) {
|
|
42
42
|
console.log(`
|
|
43
43
|
╔═══════════════════════════════════════════════╗
|
|
44
|
-
║ CC Hubber v0.3.
|
|
44
|
+
║ CC Hubber v0.3.5 ║
|
|
45
45
|
║ What you spent. Why you spent it. Is that ║
|
|
46
46
|
║ normal. ║
|
|
47
47
|
╚═══════════════════════════════════════════════╝
|
|
@@ -76,8 +76,12 @@ async function main() {
|
|
|
76
76
|
process.exit(1);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
console.log(
|
|
80
|
-
|
|
79
|
+
console.log(`
|
|
80
|
+
/\\ _ /\\
|
|
81
|
+
/ \\(_)/ \\ CC Hubber v0.3.5
|
|
82
|
+
\\ / ◉ \\ / What you spent. Why. Is that normal.
|
|
83
|
+
\\/ ~ \\/
|
|
84
|
+
`);
|
|
81
85
|
console.log(' Reading local Claude Code data...\n');
|
|
82
86
|
|
|
83
87
|
// Read all data sources
|
|
@@ -1,30 +1,63 @@
|
|
|
1
|
+
// ANSI color codes
|
|
2
|
+
const c = {
|
|
3
|
+
reset: '\x1b[0m',
|
|
4
|
+
bold: '\x1b[1m',
|
|
5
|
+
dim: '\x1b[2m',
|
|
6
|
+
red: '\x1b[31m',
|
|
7
|
+
green: '\x1b[32m',
|
|
8
|
+
yellow: '\x1b[33m',
|
|
9
|
+
blue: '\x1b[34m',
|
|
10
|
+
magenta: '\x1b[35m',
|
|
11
|
+
cyan: '\x1b[36m',
|
|
12
|
+
white: '\x1b[37m',
|
|
13
|
+
gray: '\x1b[90m',
|
|
14
|
+
bgRed: '\x1b[41m',
|
|
15
|
+
bgGreen: '\x1b[42m',
|
|
16
|
+
bgYellow: '\x1b[43m',
|
|
17
|
+
bgBlue: '\x1b[44m',
|
|
18
|
+
};
|
|
19
|
+
|
|
1
20
|
export function renderTerminal(report) {
|
|
2
|
-
const { costAnalysis, cacheHealth, anomalies, claudeMdStack, recommendations } = report;
|
|
21
|
+
const { costAnalysis, cacheHealth, anomalies, claudeMdStack, recommendations, inflection, modelRouting, sessionIntel } = report;
|
|
3
22
|
|
|
4
23
|
const grade = cacheHealth.grade || { letter: '?', label: 'Unknown' };
|
|
5
24
|
const totalCost = costAnalysis.totalCost || 0;
|
|
25
|
+
const gradeColor = grade.letter === 'A' ? c.green : grade.letter === 'B' ? c.cyan : grade.letter === 'C' ? c.yellow : c.red;
|
|
26
|
+
|
|
27
|
+
// Grade box
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log(` ${c.gray}┌─────────────────────────────────────────────────┐${c.reset}`);
|
|
30
|
+
console.log(` ${c.gray}│${c.reset} ${gradeColor}${c.bold}Grade: ${grade.letter}${c.reset} ${c.dim}(${grade.label})${c.reset}${' '.repeat(38 - grade.label.length)}${c.gray}│${c.reset}`);
|
|
31
|
+
console.log(` ${c.gray}│${c.reset} ${c.white}${c.bold}$${totalCost.toFixed(0)}${c.reset} ${c.dim}over ${costAnalysis.activeDays} active days${c.reset}${' '.repeat(Math.max(0, 29 - totalCost.toFixed(0).length - String(costAnalysis.activeDays).length))}${c.gray}│${c.reset}`);
|
|
32
|
+
console.log(` ${c.gray}│${c.reset} ${c.dim}$${(costAnalysis.avgDailyCost || 0).toFixed(2)}/day avg${c.reset} ${c.dim}│${c.reset} ${c.dim}cache ${cacheHealth.efficiencyRatio ? cacheHealth.efficiencyRatio.toLocaleString() + ':1' : 'N/A'}${c.reset}${' '.repeat(Math.max(0, 16 - String(cacheHealth.efficiencyRatio || 0).length))}${c.gray}│${c.reset}`);
|
|
33
|
+
console.log(` ${c.gray}└─────────────────────────────────────────────────┘${c.reset}`);
|
|
6
34
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
// Inflection
|
|
36
|
+
if (inflection) {
|
|
37
|
+
const dir = inflection.direction === 'worsened' ? `${c.red}▼` : `${c.green}▲`;
|
|
38
|
+
console.log(`\n ${dir} ${c.bold}${inflection.summary}${c.reset}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Model split one-liner
|
|
42
|
+
if (modelRouting?.available) {
|
|
43
|
+
console.log(`\n ${c.blue}◉${c.reset} ${c.dim}Models:${c.reset} ${modelRouting.opusPct}% Opus ${c.dim}·${c.reset} ${modelRouting.sonnetPct}% Sonnet ${c.dim}·${c.reset} ${modelRouting.haikuPct}% Haiku`);
|
|
44
|
+
}
|
|
15
45
|
|
|
46
|
+
// Anomalies
|
|
16
47
|
if (anomalies.hasAnomalies) {
|
|
17
|
-
console.log(`\n
|
|
48
|
+
console.log(`\n ${c.yellow}⚠${c.reset} ${c.bold}${anomalies.anomalies.length} anomal${anomalies.anomalies.length === 1 ? 'y' : 'ies'}${c.reset}`);
|
|
18
49
|
for (const a of anomalies.anomalies.slice(0, 3)) {
|
|
19
|
-
console.log(` ${a.date}
|
|
50
|
+
console.log(` ${c.dim}${a.date}${c.reset} ${c.white}$${a.cost.toFixed(0)}${c.reset} ${c.red}+$${a.deviation.toFixed(0)}${c.reset}`);
|
|
20
51
|
}
|
|
21
52
|
}
|
|
22
53
|
|
|
54
|
+
// Recommendations (top 3, compact)
|
|
23
55
|
if (recommendations.length > 0) {
|
|
24
|
-
console.log(
|
|
25
|
-
for (const r of recommendations.slice(0,
|
|
26
|
-
const icon = r.severity === 'critical' ?
|
|
27
|
-
|
|
56
|
+
console.log(`\n ${c.bold}Recommendations${c.reset}`);
|
|
57
|
+
for (const r of recommendations.slice(0, 4)) {
|
|
58
|
+
const icon = r.severity === 'critical' ? `${c.red}●${c.reset}` : r.severity === 'warning' ? `${c.yellow}●${c.reset}` : r.severity === 'positive' ? `${c.green}●${c.reset}` : `${c.blue}●${c.reset}`;
|
|
59
|
+
const savings = r.savings ? ` ${c.dim}(${r.savings})${c.reset}` : '';
|
|
60
|
+
console.log(` ${icon} ${r.title}${savings}`);
|
|
28
61
|
}
|
|
29
62
|
}
|
|
30
63
|
}
|
package/src/telemetry.js
CHANGED
|
@@ -7,7 +7,7 @@ import { join } from 'path';
|
|
|
7
7
|
// Opt out: npx cchubber --no-telemetry
|
|
8
8
|
// Or set env: CC_HUBBER_TELEMETRY=0
|
|
9
9
|
|
|
10
|
-
const TELEMETRY_URL = process.env.CC_HUBBER_TELEMETRY_URL || 'https://cchubber-telemetry.
|
|
10
|
+
const TELEMETRY_URL = process.env.CC_HUBBER_TELEMETRY_URL || 'https://cchubber-telemetry.asmirkhan087.workers.dev/collect';
|
|
11
11
|
|
|
12
12
|
export function shouldSendTelemetry(flags) {
|
|
13
13
|
if (flags.noTelemetry) return false;
|