@vibe-cafe/vibe-usage 0.1.10 → 0.1.12
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/parsers/claude-code.js +13 -1
- package/src/sync.js +7 -0
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export async function parse(lastSync) {
|
|
|
20
20
|
entries.push({
|
|
21
21
|
source: 'claude-code',
|
|
22
22
|
model: breakdown.modelName,
|
|
23
|
-
project: session.projectPath
|
|
23
|
+
project: stripSessionId(session.projectPath),
|
|
24
24
|
timestamp: new Date(session.lastActivity),
|
|
25
25
|
inputTokens: breakdown.inputTokens,
|
|
26
26
|
outputTokens: breakdown.outputTokens,
|
|
@@ -32,3 +32,15 @@ export async function parse(lastSync) {
|
|
|
32
32
|
|
|
33
33
|
return aggregateToBuckets(entries);
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Strip session UUID suffix from ccusage project path.
|
|
38
|
+
* ccusage returns paths like '-Users-foo-project/77e854f9-...' for subagent sessions.
|
|
39
|
+
* We only keep the directory name part before the first '/'.
|
|
40
|
+
*/
|
|
41
|
+
function stripSessionId(raw) {
|
|
42
|
+
if (!raw || raw === 'unknown' || raw === 'Unknown Project') return 'unknown';
|
|
43
|
+
const slashIdx = raw.indexOf('/');
|
|
44
|
+
if (slashIdx !== -1) return raw.slice(0, slashIdx);
|
|
45
|
+
return raw;
|
|
46
|
+
}
|
package/src/sync.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hostname as osHostname } from 'node:os';
|
|
1
2
|
import { loadConfig, saveConfig } from './config.js';
|
|
2
3
|
import { ingest } from './api.js';
|
|
3
4
|
import { parsers } from './parsers/index.js';
|
|
@@ -34,6 +35,12 @@ export async function runSync() {
|
|
|
34
35
|
return 0;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
// Tag every bucket with this machine's hostname
|
|
39
|
+
const host = osHostname().replace(/\.local$/, '');
|
|
40
|
+
for (const b of allBuckets) {
|
|
41
|
+
b.hostname = host;
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
const apiUrl = config.apiUrl || 'https://vibecafe.ai';
|
|
38
45
|
let totalIngested = 0;
|
|
39
46
|
const totalBatches = Math.ceil(allBuckets.length / BATCH_SIZE);
|