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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cchubber",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "What you spent. Why you spent it. Is that normal. — Claude Code usage diagnosis with beautiful HTML reports.",
5
5
  "type": "module",
6
6
  "bin": {
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.1
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('\n CC Hubber v0.3.1');
80
- console.log(' ─────────────────────────────');
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
- console.log(' ╔═══════════════════════════════════════════════╗');
8
- console.log(` ║ Grade: ${grade.letter} (${grade.label})`.padEnd(50) + '║');
9
- console.log(` ║ Total: $${totalCost.toFixed(2)} over ${costAnalysis.activeDays} active days`.padEnd(50) + '║');
10
- console.log(` ║ Avg/day: $${(costAnalysis.avgDailyCost || 0).toFixed(2)}`.padEnd(50) + '║');
11
- console.log(` ║ Cache ratio: ${cacheHealth.efficiencyRatio ? cacheHealth.efficiencyRatio.toLocaleString() + ':1' : 'N/A'}`.padEnd(50) + '║');
12
- console.log(` ║ Cache breaks: ${cacheHealth.totalCacheBreaks || 0}`.padEnd(50) + '║');
13
- console.log(` ║ CLAUDE.md: ~${claudeMdStack.totalTokensEstimate.toLocaleString()} tokens`.padEnd(50) + '║');
14
- console.log(' ╚═══════════════════════════════════════════════╝');
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 ${anomalies.anomalies.length} anomal${anomalies.anomalies.length === 1 ? 'y' : 'ies'} detected:`);
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}: $${a.cost.toFixed(2)} (${a.deviation > 0 ? '+' : ''}$${a.deviation.toFixed(2)} from avg)`);
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('\n Recommendations:');
25
- for (const r of recommendations.slice(0, 3)) {
26
- const icon = r.severity === 'critical' ? '✗' : r.severity === 'warning' ? '!' : r.severity === 'positive' ? '✓' : '·';
27
- console.log(` ${icon} ${r.title}`);
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.azkhh.workers.dev/collect';
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;