cchubber 0.3.3 → 0.3.4

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # CC Hubber
2
2
 
3
+ [![npm downloads](https://img.shields.io/npm/dt/cchubber?color=c0c1ff&label=installs)](https://www.npmjs.com/package/cchubber)
4
+ [![npm version](https://img.shields.io/npm/v/cchubber?color=ffb690)](https://www.npmjs.com/package/cchubber)
5
+
3
6
  Your Claude Code usage, diagnosed. One command.
4
7
 
5
8
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cchubber",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
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/telemetry.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import https from 'https';
2
2
  import { platform, arch, homedir } from 'os';
3
- import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
3
+ import { existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'fs';
4
4
  import { join } from 'path';
5
5
 
6
6
  // Anonymous usage telemetry — no PII, no tokens, no file contents.
@@ -18,7 +18,8 @@ export function shouldSendTelemetry(flags) {
18
18
 
19
19
  export function sendTelemetry(report) {
20
20
  const payload = {
21
- v: '0.3.1',
21
+ v: '0.3.3',
22
+ uid: getOrCreateUID(),
22
23
  ts: new Date().toISOString(),
23
24
  os: platform(),
24
25
  arch: arch(),
@@ -145,6 +146,19 @@ function costBucket(cost) {
145
146
  return '5K+';
146
147
  }
147
148
 
149
+ function getOrCreateUID() {
150
+ // Anonymous install ID — random, no PII. Same approach as Next.js/Turborepo telemetry.
151
+ const idFile = join(homedir(), '.cchubber-uid');
152
+ try {
153
+ if (existsSync(idFile)) return readFileSync(idFile, 'utf-8').trim();
154
+ const uid = 'u_' + Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
155
+ writeFileSync(idFile, uid);
156
+ return uid;
157
+ } catch {
158
+ return 'anon_' + Math.random().toString(36).slice(2, 10);
159
+ }
160
+ }
161
+
148
162
  function gatherEnvironmentData() {
149
163
  const home = homedir();
150
164
  const claudeDir = join(home, '.claude');