@revenium/claude-code-metering 0.1.0
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/CHANGELOG.md +50 -0
- package/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/cli/commands/backfill.d.ts +11 -0
- package/dist/cli/commands/backfill.d.ts.map +1 -0
- package/dist/cli/commands/backfill.js +390 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +13 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +177 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.d.ts +5 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +95 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/test.d.ts +9 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/test.js +67 -0
- package/dist/cli/commands/test.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +65 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/api/client.d.ts +28 -0
- package/dist/core/api/client.d.ts.map +1 -0
- package/dist/core/api/client.js +127 -0
- package/dist/core/api/client.js.map +1 -0
- package/dist/core/config/loader.d.ts +35 -0
- package/dist/core/config/loader.d.ts.map +1 -0
- package/dist/core/config/loader.js +162 -0
- package/dist/core/config/loader.js.map +1 -0
- package/dist/core/config/validator.d.ts +19 -0
- package/dist/core/config/validator.d.ts.map +1 -0
- package/dist/core/config/validator.js +101 -0
- package/dist/core/config/validator.js.map +1 -0
- package/dist/core/config/writer.d.ts +11 -0
- package/dist/core/config/writer.d.ts.map +1 -0
- package/dist/core/config/writer.js +145 -0
- package/dist/core/config/writer.js.map +1 -0
- package/dist/core/shell/detector.d.ts +14 -0
- package/dist/core/shell/detector.d.ts.map +1 -0
- package/dist/core/shell/detector.js +69 -0
- package/dist/core/shell/detector.js.map +1 -0
- package/dist/core/shell/profile-updater.d.ts +11 -0
- package/dist/core/shell/profile-updater.d.ts.map +1 -0
- package/dist/core/shell/profile-updater.js +101 -0
- package/dist/core/shell/profile-updater.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +96 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/constants.d.ts +68 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +73 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/masking.d.ts +14 -0
- package/dist/utils/masking.d.ts.map +1 -0
- package/dist/utils/masking.js +33 -0
- package/dist/utils/masking.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.backfillCommand = backfillCommand;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const node_readline_1 = require("node:readline");
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
const ora_1 = __importDefault(require("ora"));
|
|
14
|
+
const loader_js_1 = require("../../core/config/loader.js");
|
|
15
|
+
const client_js_1 = require("../../core/api/client.js");
|
|
16
|
+
const constants_js_1 = require("../../utils/constants.js");
|
|
17
|
+
/**
|
|
18
|
+
* Parses a relative date string like "7d" or "1m" into a Date.
|
|
19
|
+
*/
|
|
20
|
+
function parseRelativeDate(input) {
|
|
21
|
+
const match = input.match(/^(\d+)([dmwMy])$/);
|
|
22
|
+
if (!match)
|
|
23
|
+
return null;
|
|
24
|
+
const amount = parseInt(match[1], 10);
|
|
25
|
+
const unit = match[2];
|
|
26
|
+
const now = new Date();
|
|
27
|
+
switch (unit) {
|
|
28
|
+
case 'd':
|
|
29
|
+
now.setDate(now.getDate() - amount);
|
|
30
|
+
break;
|
|
31
|
+
case 'w':
|
|
32
|
+
now.setDate(now.getDate() - amount * 7);
|
|
33
|
+
break;
|
|
34
|
+
case 'm':
|
|
35
|
+
now.setMonth(now.getMonth() - amount);
|
|
36
|
+
break;
|
|
37
|
+
case 'M':
|
|
38
|
+
now.setMonth(now.getMonth() - amount);
|
|
39
|
+
break;
|
|
40
|
+
case 'y':
|
|
41
|
+
now.setFullYear(now.getFullYear() - amount);
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return now;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parses the --since option into a Date.
|
|
50
|
+
*/
|
|
51
|
+
function parseSinceDate(since) {
|
|
52
|
+
// Try relative format first
|
|
53
|
+
const relativeDate = parseRelativeDate(since);
|
|
54
|
+
if (relativeDate)
|
|
55
|
+
return relativeDate;
|
|
56
|
+
// Try ISO format
|
|
57
|
+
const isoDate = new Date(since);
|
|
58
|
+
if (!isNaN(isoDate.getTime()))
|
|
59
|
+
return isoDate;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Recursively finds all .jsonl files in a directory.
|
|
64
|
+
* Returns an object with found files and any errors encountered.
|
|
65
|
+
*/
|
|
66
|
+
async function findJsonlFiles(dir, errors = []) {
|
|
67
|
+
const files = [];
|
|
68
|
+
try {
|
|
69
|
+
const entries = await (0, promises_1.readdir)(dir, { withFileTypes: true });
|
|
70
|
+
for (const entry of entries) {
|
|
71
|
+
const fullPath = (0, node_path_1.join)(dir, entry.name);
|
|
72
|
+
if (entry.isDirectory()) {
|
|
73
|
+
const result = await findJsonlFiles(fullPath, errors);
|
|
74
|
+
files.push(...result.files);
|
|
75
|
+
}
|
|
76
|
+
else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
|
77
|
+
files.push(fullPath);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
83
|
+
errors.push(`${dir}: ${message}`);
|
|
84
|
+
}
|
|
85
|
+
return { files, errors };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Streams a JSONL file and extracts records with usage data.
|
|
89
|
+
* Yields objects indicating either a valid record or a parse error.
|
|
90
|
+
*/
|
|
91
|
+
async function* streamJsonlRecords(filePath, sinceDate) {
|
|
92
|
+
const fileStream = (0, node_fs_1.createReadStream)(filePath);
|
|
93
|
+
const rl = (0, node_readline_1.createInterface)({
|
|
94
|
+
input: fileStream,
|
|
95
|
+
crlfDelay: Infinity,
|
|
96
|
+
});
|
|
97
|
+
try {
|
|
98
|
+
for await (const line of rl) {
|
|
99
|
+
if (!line.trim())
|
|
100
|
+
continue;
|
|
101
|
+
try {
|
|
102
|
+
const entry = JSON.parse(line);
|
|
103
|
+
// Only process assistant messages with usage data
|
|
104
|
+
if (entry.type !== 'assistant' || !entry.message?.usage)
|
|
105
|
+
continue;
|
|
106
|
+
const usage = entry.message.usage;
|
|
107
|
+
const timestamp = entry.timestamp;
|
|
108
|
+
const sessionId = entry.sessionId;
|
|
109
|
+
const model = entry.message.model;
|
|
110
|
+
// Skip if missing required fields
|
|
111
|
+
if (!timestamp || !sessionId || !model)
|
|
112
|
+
continue;
|
|
113
|
+
// Validate timestamp is a valid date
|
|
114
|
+
const entryDate = new Date(timestamp);
|
|
115
|
+
if (!Number.isFinite(entryDate.getTime()))
|
|
116
|
+
continue;
|
|
117
|
+
// Check date filter
|
|
118
|
+
if (sinceDate) {
|
|
119
|
+
if (entryDate < sinceDate)
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// Skip entries with no actual token usage
|
|
123
|
+
const totalTokens = (usage.input_tokens || 0) +
|
|
124
|
+
(usage.output_tokens || 0) +
|
|
125
|
+
(usage.cache_read_input_tokens || 0) +
|
|
126
|
+
(usage.cache_creation_input_tokens || 0);
|
|
127
|
+
if (totalTokens === 0)
|
|
128
|
+
continue;
|
|
129
|
+
yield {
|
|
130
|
+
record: {
|
|
131
|
+
sessionId,
|
|
132
|
+
timestamp,
|
|
133
|
+
model,
|
|
134
|
+
inputTokens: usage.input_tokens || 0,
|
|
135
|
+
outputTokens: usage.output_tokens || 0,
|
|
136
|
+
cacheReadTokens: usage.cache_read_input_tokens || 0,
|
|
137
|
+
cacheCreationTokens: usage.cache_creation_input_tokens || 0,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Invalid JSON line, signal parse error
|
|
143
|
+
yield { parseError: true };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
// Ensure file stream is properly closed even on early exit
|
|
149
|
+
fileStream.destroy();
|
|
150
|
+
rl.close();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Converts a timestamp to nanoseconds since Unix epoch.
|
|
155
|
+
* Returns null if the timestamp is invalid.
|
|
156
|
+
*/
|
|
157
|
+
function toUnixNano(timestamp) {
|
|
158
|
+
const date = new Date(timestamp);
|
|
159
|
+
const ms = date.getTime();
|
|
160
|
+
if (!Number.isFinite(ms)) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return (BigInt(ms) * BigInt(1_000_000)).toString();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates an OTEL metrics payload from parsed records.
|
|
167
|
+
* Each record generates multiple metrics (input_tokens, output_tokens, etc.)
|
|
168
|
+
*/
|
|
169
|
+
function createOtlpPayload(records, costMultiplier) {
|
|
170
|
+
// Build metrics for all records
|
|
171
|
+
const allMetrics = [];
|
|
172
|
+
for (const record of records) {
|
|
173
|
+
const timeUnixNano = toUnixNano(record.timestamp);
|
|
174
|
+
if (timeUnixNano === null)
|
|
175
|
+
continue;
|
|
176
|
+
// Common attributes for this record
|
|
177
|
+
const attributes = [
|
|
178
|
+
{ key: 'ai.transaction_id', value: { stringValue: record.sessionId } },
|
|
179
|
+
{ key: 'ai.model', value: { stringValue: record.model } },
|
|
180
|
+
{ key: 'ai.provider', value: { stringValue: 'anthropic' } },
|
|
181
|
+
{ key: 'cost_multiplier', value: { doubleValue: costMultiplier } },
|
|
182
|
+
];
|
|
183
|
+
// Create metrics for each token type
|
|
184
|
+
const tokenMetrics = [
|
|
185
|
+
{ name: 'ai.tokens.input', value: record.inputTokens },
|
|
186
|
+
{ name: 'ai.tokens.output', value: record.outputTokens },
|
|
187
|
+
{ name: 'ai.tokens.cache_read', value: record.cacheReadTokens },
|
|
188
|
+
{ name: 'ai.tokens.cache_creation', value: record.cacheCreationTokens },
|
|
189
|
+
];
|
|
190
|
+
for (const metric of tokenMetrics) {
|
|
191
|
+
allMetrics.push({
|
|
192
|
+
name: metric.name,
|
|
193
|
+
sum: {
|
|
194
|
+
dataPoints: [{
|
|
195
|
+
attributes,
|
|
196
|
+
timeUnixNano,
|
|
197
|
+
asInt: metric.value,
|
|
198
|
+
}],
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
resourceMetrics: [
|
|
205
|
+
{
|
|
206
|
+
resource: {
|
|
207
|
+
attributes: [
|
|
208
|
+
{ key: 'service.name', value: { stringValue: 'claude-code' } },
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
scopeMetrics: [
|
|
212
|
+
{
|
|
213
|
+
metrics: allMetrics,
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Backfill command - imports historical Claude Code usage data.
|
|
222
|
+
*/
|
|
223
|
+
async function backfillCommand(options = {}) {
|
|
224
|
+
const { since, dryRun = false, batchSize = 100, verbose = false } = options;
|
|
225
|
+
console.log(chalk_1.default.bold('\nRevenium Claude Code Backfill\n'));
|
|
226
|
+
if (dryRun) {
|
|
227
|
+
console.log(chalk_1.default.yellow('Running in dry-run mode - no data will be sent\n'));
|
|
228
|
+
}
|
|
229
|
+
// Load configuration
|
|
230
|
+
const config = await (0, loader_js_1.loadConfig)();
|
|
231
|
+
if (!config) {
|
|
232
|
+
console.log(chalk_1.default.red('Configuration not found'));
|
|
233
|
+
console.log(chalk_1.default.yellow('\nRun `revenium-metering setup` to configure Claude Code metering.'));
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
// Parse since date
|
|
237
|
+
let sinceDate = null;
|
|
238
|
+
if (since) {
|
|
239
|
+
sinceDate = parseSinceDate(since);
|
|
240
|
+
if (!sinceDate) {
|
|
241
|
+
console.log(chalk_1.default.red(`Invalid --since value: ${since}`));
|
|
242
|
+
console.log(chalk_1.default.dim('Use ISO format (2024-01-15) or relative format (7d, 1m, 1y)'));
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
console.log(chalk_1.default.dim(`Filtering records since: ${sinceDate.toISOString()}\n`));
|
|
246
|
+
}
|
|
247
|
+
// Get cost multiplier (use ?? to allow explicit 0 override for free tier/testing)
|
|
248
|
+
const costMultiplier = config.costMultiplierOverride ??
|
|
249
|
+
(config.subscriptionTier ? (0, constants_js_1.getCostMultiplier)(config.subscriptionTier) : 0.08);
|
|
250
|
+
// Discover JSONL files
|
|
251
|
+
const projectsDir = (0, node_path_1.join)((0, node_os_1.homedir)(), '.claude', 'projects');
|
|
252
|
+
const discoverSpinner = (0, ora_1.default)('Discovering JSONL files...').start();
|
|
253
|
+
const { files: jsonlFiles, errors: discoveryErrors } = await findJsonlFiles(projectsDir);
|
|
254
|
+
if (discoveryErrors.length > 0 && verbose) {
|
|
255
|
+
discoverSpinner.warn(`Found ${jsonlFiles.length} JSONL file(s) with ${discoveryErrors.length} directory error(s)`);
|
|
256
|
+
console.log(chalk_1.default.yellow('\nDirectory access errors:'));
|
|
257
|
+
for (const error of discoveryErrors.slice(0, 5)) {
|
|
258
|
+
console.log(chalk_1.default.yellow(` ${error}`));
|
|
259
|
+
}
|
|
260
|
+
if (discoveryErrors.length > 5) {
|
|
261
|
+
console.log(chalk_1.default.yellow(` ... and ${discoveryErrors.length - 5} more`));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else if (jsonlFiles.length === 0) {
|
|
265
|
+
discoverSpinner.fail('No JSONL files found');
|
|
266
|
+
console.log(chalk_1.default.dim(`Searched in: ${projectsDir}`));
|
|
267
|
+
if (discoveryErrors.length > 0) {
|
|
268
|
+
console.log(chalk_1.default.yellow('\nDirectory access errors:'));
|
|
269
|
+
for (const error of discoveryErrors) {
|
|
270
|
+
console.log(chalk_1.default.yellow(` ${error}`));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
process.exit(1);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
discoverSpinner.succeed(`Found ${jsonlFiles.length} JSONL file(s)`);
|
|
277
|
+
}
|
|
278
|
+
if (verbose) {
|
|
279
|
+
console.log(chalk_1.default.dim('\nFiles:'));
|
|
280
|
+
for (const file of jsonlFiles.slice(0, 10)) {
|
|
281
|
+
console.log(chalk_1.default.dim(` ${file}`));
|
|
282
|
+
}
|
|
283
|
+
if (jsonlFiles.length > 10) {
|
|
284
|
+
console.log(chalk_1.default.dim(` ... and ${jsonlFiles.length - 10} more`));
|
|
285
|
+
}
|
|
286
|
+
console.log('');
|
|
287
|
+
}
|
|
288
|
+
// Process files and collect records
|
|
289
|
+
const processSpinner = (0, ora_1.default)('Processing files...').start();
|
|
290
|
+
const allRecords = [];
|
|
291
|
+
let processedFiles = 0;
|
|
292
|
+
let skippedLines = 0;
|
|
293
|
+
let skippedFiles = 0;
|
|
294
|
+
for (const file of jsonlFiles) {
|
|
295
|
+
try {
|
|
296
|
+
for await (const result of streamJsonlRecords(file, sinceDate)) {
|
|
297
|
+
if (result.parseError) {
|
|
298
|
+
skippedLines++;
|
|
299
|
+
}
|
|
300
|
+
else if (result.record) {
|
|
301
|
+
allRecords.push(result.record);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
processedFiles++;
|
|
305
|
+
processSpinner.text = `Processing files... (${processedFiles}/${jsonlFiles.length})`;
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
skippedFiles++;
|
|
309
|
+
if (verbose) {
|
|
310
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
311
|
+
console.log(chalk_1.default.yellow(`\nWarning: Could not process ${file}: ${message}`));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// Build status message with skipped line info
|
|
316
|
+
let statusMessage = `Processed ${processedFiles} files, found ${allRecords.length} usage records`;
|
|
317
|
+
if (skippedLines > 0) {
|
|
318
|
+
statusMessage += chalk_1.default.yellow(` (${skippedLines} malformed line${skippedLines > 1 ? 's' : ''} skipped)`);
|
|
319
|
+
}
|
|
320
|
+
if (skippedFiles > 0) {
|
|
321
|
+
statusMessage += chalk_1.default.yellow(` (${skippedFiles} file${skippedFiles > 1 ? 's' : ''} failed)`);
|
|
322
|
+
}
|
|
323
|
+
processSpinner.succeed(statusMessage);
|
|
324
|
+
if (allRecords.length === 0) {
|
|
325
|
+
console.log(chalk_1.default.yellow('\nNo usage records found to backfill.'));
|
|
326
|
+
if (since) {
|
|
327
|
+
console.log(chalk_1.default.dim(`Try a broader date range or remove the --since filter.`));
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
// Sort records by timestamp
|
|
332
|
+
allRecords.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
333
|
+
// Show summary
|
|
334
|
+
const oldestRecord = allRecords[0];
|
|
335
|
+
const newestRecord = allRecords[allRecords.length - 1];
|
|
336
|
+
const totalInputTokens = allRecords.reduce((sum, r) => sum + r.inputTokens, 0);
|
|
337
|
+
const totalOutputTokens = allRecords.reduce((sum, r) => sum + r.outputTokens, 0);
|
|
338
|
+
const totalCacheReadTokens = allRecords.reduce((sum, r) => sum + r.cacheReadTokens, 0);
|
|
339
|
+
const totalCacheCreationTokens = allRecords.reduce((sum, r) => sum + r.cacheCreationTokens, 0);
|
|
340
|
+
console.log('\n' + chalk_1.default.bold('Summary:'));
|
|
341
|
+
console.log(` Records: ${allRecords.length.toLocaleString()}`);
|
|
342
|
+
console.log(` Date range: ${oldestRecord.timestamp.split('T')[0]} to ${newestRecord.timestamp.split('T')[0]}`);
|
|
343
|
+
console.log(` Input tokens: ${totalInputTokens.toLocaleString()}`);
|
|
344
|
+
console.log(` Output tokens: ${totalOutputTokens.toLocaleString()}`);
|
|
345
|
+
console.log(` Cache read tokens: ${totalCacheReadTokens.toLocaleString()}`);
|
|
346
|
+
console.log(` Cache creation: ${totalCacheCreationTokens.toLocaleString()}`);
|
|
347
|
+
console.log(` Cost multiplier: ${costMultiplier}`);
|
|
348
|
+
if (dryRun) {
|
|
349
|
+
console.log('\n' + chalk_1.default.yellow('Dry run complete. Use without --dry-run to send data.'));
|
|
350
|
+
if (verbose) {
|
|
351
|
+
console.log('\n' + chalk_1.default.dim('Sample OTLP payload (first batch):'));
|
|
352
|
+
const sampleRecords = allRecords.slice(0, Math.min(batchSize, 3));
|
|
353
|
+
const samplePayload = createOtlpPayload(sampleRecords, costMultiplier);
|
|
354
|
+
console.log(chalk_1.default.dim(JSON.stringify(samplePayload, null, 2)));
|
|
355
|
+
}
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
// Send data in batches
|
|
359
|
+
const totalBatches = Math.ceil(allRecords.length / batchSize);
|
|
360
|
+
const sendSpinner = (0, ora_1.default)(`Sending data... (0/${totalBatches} batches)`).start();
|
|
361
|
+
let sentBatches = 0;
|
|
362
|
+
let sentRecords = 0;
|
|
363
|
+
let failedBatches = 0;
|
|
364
|
+
for (let i = 0; i < allRecords.length; i += batchSize) {
|
|
365
|
+
const batch = allRecords.slice(i, i + batchSize);
|
|
366
|
+
const payload = createOtlpPayload(batch, costMultiplier);
|
|
367
|
+
try {
|
|
368
|
+
await (0, client_js_1.sendOtlpMetrics)(config.endpoint, config.apiKey, payload);
|
|
369
|
+
sentBatches++;
|
|
370
|
+
sentRecords += batch.length;
|
|
371
|
+
sendSpinner.text = `Sending data... (${sentBatches}/${totalBatches} batches)`;
|
|
372
|
+
}
|
|
373
|
+
catch (error) {
|
|
374
|
+
failedBatches++;
|
|
375
|
+
if (verbose) {
|
|
376
|
+
const batchNumber = Math.floor(i / batchSize) + 1;
|
|
377
|
+
console.log(chalk_1.default.yellow(`\nBatch ${batchNumber} failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (failedBatches === 0) {
|
|
382
|
+
sendSpinner.succeed(`Sent ${sentRecords.toLocaleString()} records in ${sentBatches} batches`);
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
sendSpinner.warn(`Sent ${sentRecords.toLocaleString()} records in ${sentBatches} batches (${failedBatches} failed)`);
|
|
386
|
+
}
|
|
387
|
+
console.log('\n' + chalk_1.default.green.bold('Backfill complete!'));
|
|
388
|
+
console.log(chalk_1.default.dim('Check your Revenium dashboard to see the imported data.'));
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=backfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backfill.js","sourceRoot":"","sources":["../../../src/cli/commands/backfill.ts"],"names":[],"mappings":";;;;;AAoSA,0CA8LC;AAleD,qCAA2C;AAC3C,+CAAiD;AACjD,qCAAkC;AAClC,yCAAiC;AACjC,iDAAgD;AAChD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4
|
+
tier?: string;
|
|
5
|
+
endpoint?: string;
|
|
6
|
+
skipShellUpdate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Interactive setup wizard for Revenium Claude Code metering.
|
|
10
|
+
*/
|
|
11
|
+
export declare function setupCommand(options?: SetupOptions): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/setup.ts"],"names":[],"mappings":"AAiBA,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuE5E"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setupCommand = setupCommand;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
const constants_js_1 = require("../../utils/constants.js");
|
|
11
|
+
const masking_js_1 = require("../../utils/masking.js");
|
|
12
|
+
const validator_js_1 = require("../../core/config/validator.js");
|
|
13
|
+
const writer_js_1 = require("../../core/config/writer.js");
|
|
14
|
+
const client_js_1 = require("../../core/api/client.js");
|
|
15
|
+
const profile_updater_js_1 = require("../../core/shell/profile-updater.js");
|
|
16
|
+
const detector_js_1 = require("../../core/shell/detector.js");
|
|
17
|
+
/**
|
|
18
|
+
* Interactive setup wizard for Revenium Claude Code metering.
|
|
19
|
+
*/
|
|
20
|
+
async function setupCommand(options = {}) {
|
|
21
|
+
console.log(chalk_1.default.bold('\nRevenium Claude Code Metering Setup\n'));
|
|
22
|
+
console.log(chalk_1.default.dim('This wizard will configure Claude Code to export telemetry to Revenium.\n'));
|
|
23
|
+
// Collect configuration
|
|
24
|
+
const config = await collectConfiguration(options);
|
|
25
|
+
// Validate API key with endpoint
|
|
26
|
+
const spinner = (0, ora_1.default)('Testing API key...').start();
|
|
27
|
+
try {
|
|
28
|
+
const healthResult = await (0, client_js_1.checkEndpointHealth)(config.endpoint, config.apiKey);
|
|
29
|
+
if (!healthResult.healthy) {
|
|
30
|
+
spinner.fail(`API key validation failed: ${healthResult.message}`);
|
|
31
|
+
console.log(chalk_1.default.yellow('\nPlease check your API key and try again. If the problem persists, contact support.'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
spinner.succeed(`API key validated (${healthResult.latencyMs}ms latency)`);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
spinner.fail('Failed to validate API key');
|
|
38
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
// Write configuration file
|
|
42
|
+
const writeSpinner = (0, ora_1.default)('Writing configuration...').start();
|
|
43
|
+
try {
|
|
44
|
+
const configPath = await (0, writer_js_1.writeConfig)(config);
|
|
45
|
+
writeSpinner.succeed(`Configuration written to ${chalk_1.default.cyan(configPath)}`);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
writeSpinner.fail('Failed to write configuration');
|
|
49
|
+
console.error(chalk_1.default.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
// Update shell profile
|
|
53
|
+
if (!options.skipShellUpdate) {
|
|
54
|
+
const shellSpinner = (0, ora_1.default)('Updating shell profile...').start();
|
|
55
|
+
try {
|
|
56
|
+
const shellResult = await (0, profile_updater_js_1.updateShellProfile)();
|
|
57
|
+
if (shellResult.success) {
|
|
58
|
+
shellSpinner.succeed(shellResult.message);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
shellSpinner.warn(shellResult.message);
|
|
62
|
+
const shellType = (0, detector_js_1.detectShell)();
|
|
63
|
+
console.log(chalk_1.default.dim(`\nManual setup:\n${(0, profile_updater_js_1.getManualInstructions)(shellType)}`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
shellSpinner.warn('Could not update shell profile automatically');
|
|
68
|
+
const shellType = (0, detector_js_1.detectShell)();
|
|
69
|
+
console.log(chalk_1.default.dim(`\nManual setup:\n${(0, profile_updater_js_1.getManualInstructions)(shellType)}`));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Print success message
|
|
73
|
+
printSuccessMessage(config);
|
|
74
|
+
}
|
|
75
|
+
async function collectConfiguration(options) {
|
|
76
|
+
const answers = await inquirer_1.default.prompt([
|
|
77
|
+
{
|
|
78
|
+
type: 'password',
|
|
79
|
+
name: 'apiKey',
|
|
80
|
+
message: 'Enter your Revenium API key:',
|
|
81
|
+
when: !options.apiKey,
|
|
82
|
+
validate: (input) => {
|
|
83
|
+
const result = (0, validator_js_1.validateApiKey)(input);
|
|
84
|
+
return result.valid || result.errors.join(', ');
|
|
85
|
+
},
|
|
86
|
+
mask: '*',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'input',
|
|
90
|
+
name: 'email',
|
|
91
|
+
message: 'Enter your email (for usage attribution):',
|
|
92
|
+
when: !options.email,
|
|
93
|
+
validate: (input) => {
|
|
94
|
+
if (!input)
|
|
95
|
+
return true; // Optional
|
|
96
|
+
const result = (0, validator_js_1.validateEmail)(input);
|
|
97
|
+
return result.valid || result.errors.join(', ');
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'list',
|
|
102
|
+
name: 'tier',
|
|
103
|
+
message: 'Select your Claude Code subscription tier (for estimating discounts from list API rates):',
|
|
104
|
+
when: !options.tier,
|
|
105
|
+
pageSize: 20,
|
|
106
|
+
choices: [
|
|
107
|
+
...Object.entries(constants_js_1.SUBSCRIPTION_TIER_CONFIG).map(([key, config]) => ({
|
|
108
|
+
name: config.name,
|
|
109
|
+
value: key,
|
|
110
|
+
})),
|
|
111
|
+
new inquirer_1.default.Separator(' '),
|
|
112
|
+
new inquirer_1.default.Separator(chalk_1.default.dim(' Note: if you have a custom discount from Anthropic, you can configure it later in ~/.claude/revenium.env.')),
|
|
113
|
+
new inquirer_1.default.Separator(' '),
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'input',
|
|
118
|
+
name: 'endpoint',
|
|
119
|
+
message: 'Revenium API endpoint:',
|
|
120
|
+
default: constants_js_1.DEFAULT_REVENIUM_URL,
|
|
121
|
+
when: !options.endpoint,
|
|
122
|
+
validate: (input) => {
|
|
123
|
+
try {
|
|
124
|
+
new URL(input);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return 'Please enter a valid URL';
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
133
|
+
// Normalize endpoint by removing trailing slashes and /meter paths
|
|
134
|
+
const rawEndpoint = options.endpoint || answers.endpoint || constants_js_1.DEFAULT_REVENIUM_URL;
|
|
135
|
+
let endpoint = rawEndpoint.replace(/\/+$/, ''); // Remove trailing slashes
|
|
136
|
+
// Strip /meter paths if user included them (e.g., /meter/v2/otlp, /meter/v2/ai/otlp, or just /meter)
|
|
137
|
+
try {
|
|
138
|
+
const url = new URL(endpoint);
|
|
139
|
+
if (url.pathname.includes('/meter')) {
|
|
140
|
+
url.pathname = url.pathname.split('/meter')[0];
|
|
141
|
+
endpoint = url.origin + url.pathname;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// If URL parsing fails, just use the cleaned endpoint as-is
|
|
146
|
+
}
|
|
147
|
+
// Remove any remaining trailing slashes after path manipulation
|
|
148
|
+
endpoint = endpoint.replace(/\/+$/, '');
|
|
149
|
+
return {
|
|
150
|
+
apiKey: options.apiKey || answers.apiKey,
|
|
151
|
+
email: options.email || answers.email || undefined,
|
|
152
|
+
subscriptionTier: (options.tier || answers.tier),
|
|
153
|
+
endpoint,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function printSuccessMessage(config) {
|
|
157
|
+
console.log('\n' + chalk_1.default.green.bold('Setup complete!') + '\n');
|
|
158
|
+
console.log(chalk_1.default.bold('Configuration:'));
|
|
159
|
+
console.log(` API Key: ${(0, masking_js_1.maskApiKey)(config.apiKey)}`);
|
|
160
|
+
console.log(` Endpoint: ${config.endpoint}`);
|
|
161
|
+
if (config.email) {
|
|
162
|
+
console.log(` Email: ${(0, masking_js_1.maskEmail)(config.email)}`);
|
|
163
|
+
}
|
|
164
|
+
if (config.subscriptionTier) {
|
|
165
|
+
const tier = config.subscriptionTier;
|
|
166
|
+
const tierConfig = constants_js_1.SUBSCRIPTION_TIER_CONFIG[tier];
|
|
167
|
+
console.log(` Tier: ${tierConfig.name}`);
|
|
168
|
+
}
|
|
169
|
+
console.log('\n' + chalk_1.default.yellow.bold('Next steps:'));
|
|
170
|
+
console.log(' 1. Restart your terminal or run:');
|
|
171
|
+
console.log(chalk_1.default.cyan(' source ~/.claude/revenium.env'));
|
|
172
|
+
console.log(' 2. Start using Claude Code - telemetry will be sent automatically');
|
|
173
|
+
console.log(' 3. Check your usage at https://app.revenium.ai');
|
|
174
|
+
console.log('\n' +
|
|
175
|
+
chalk_1.default.dim('Run `revenium-metering status` to verify the configuration at any time.'));
|
|
176
|
+
}
|
|
177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