@vibe-cafe/vibe-usage 0.7.2 → 0.7.3

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
@@ -90,7 +90,19 @@ VIBE_USAGE_DEV=1 npx @vibe-cafe/vibe-usage sync
90
90
 
91
91
  ## Config
92
92
 
93
- Config stored at `~/.vibe-usage/config.json` (dev: `config.dev.json`). Contains your API key and server URL.
93
+ Config stored at `~/.vibe-usage/config.json` (dev: `config.dev.json`).
94
+
95
+ | Key | Description |
96
+ |-----|-------------|
97
+ | `apiKey` | Your API key (starts with `vbu_`) |
98
+ | `apiUrl` | Server URL (default: `https://vibecafe.ai`) |
99
+ | `hostname` | Stable device name for usage tracking (set at init, reused across syncs) |
100
+
101
+ The `hostname` is captured once during `init` and reused for all future syncs. This prevents macOS mDNS hostname changes (e.g., `MacBook-Pro` → `MacBook-Pro-2`) from creating duplicate device entries. To change it manually:
102
+
103
+ ```bash
104
+ npx @vibe-cafe/vibe-usage config set hostname my-device-name
105
+ ```
94
106
 
95
107
  ## Daemon Mode
96
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-cafe/vibe-usage",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Track your AI coding tool token usage and sync to vibecafe.ai",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -34,7 +34,7 @@ async function showStatus() {
34
34
  console.log();
35
35
  }
36
36
 
37
- const VALID_CONFIG_KEYS = ['apiKey', 'apiUrl'];
37
+ const VALID_CONFIG_KEYS = ['apiKey', 'apiUrl', 'hostname'];
38
38
 
39
39
  function handleConfig(args) {
40
40
  const sub = args[0];
package/src/init.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createInterface } from 'node:readline';
2
2
  import { execFile } from 'node:child_process';
3
- import { platform } from 'node:os';
3
+ import { hostname as osHostname, platform } from 'node:os';
4
4
  import { loadConfig, saveConfig } from './config.js';
5
5
  import { ingest } from './api.js';
6
6
  import { runSync } from './sync.js';
@@ -61,6 +61,7 @@ export async function runInit() {
61
61
  const config = {
62
62
  apiKey,
63
63
  apiUrl,
64
+ hostname: existing?.hostname || osHostname().replace(/\.local$/, ''),
64
65
  };
65
66
  saveConfig(config);
66
67
 
package/src/sync.js CHANGED
@@ -59,7 +59,12 @@ export async function runSync({ throws = false, quiet = false } = {}) {
59
59
  }
60
60
  }
61
61
 
62
- const host = osHostname().replace(/\.local$/, '');
62
+ let host = config.hostname;
63
+ if (!host) {
64
+ host = osHostname().replace(/\.local$/, '');
65
+ config.hostname = host;
66
+ saveConfig(config);
67
+ }
63
68
  for (const b of allBuckets) {
64
69
  b.hostname = host;
65
70
  }