claudeusage-sync 0.1.0 → 0.2.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/dist/commands/sync.js +8 -19
- package/package.json +2 -2
package/dist/commands/sync.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import ora from "ora";
|
|
3
|
-
import { createInterface } from "node:readline/promises";
|
|
4
3
|
import { buildPayload, latestWatermark } from "../aggregate/payload.js";
|
|
5
4
|
import { IngestConflict, NeedsReauth, postIngest, RateLimited, } from "../api/ingest-client.js";
|
|
6
5
|
import { deleteConfig, readConfig, writeConfig, } from "../auth/config.js";
|
|
@@ -43,23 +42,17 @@ async function readRecords() {
|
|
|
43
42
|
}
|
|
44
43
|
return records;
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
// Shown once, on the first sync — transparency, not a question. Authorization
|
|
46
|
+
// already happened in the browser device-approval step, so there's nothing to
|
|
47
|
+
// answer here; the CLI just states exactly what it uploads and proceeds.
|
|
48
|
+
function printUploadNotice(dayCount, sessionCount) {
|
|
50
49
|
console.log("");
|
|
51
|
-
console.log(chalk.bold("
|
|
50
|
+
console.log(chalk.bold("uploading aggregate usage only:"));
|
|
52
51
|
console.log(` ${dayCount} day-buckets across ${sessionCount} sessions`);
|
|
53
52
|
console.log(" numeric totals only: tokens, hours, and message counts");
|
|
54
|
-
console.log(
|
|
55
|
-
console.log(
|
|
53
|
+
console.log(chalk.gray(" never uploaded: prompts, responses, file paths, project names, or raw files"));
|
|
54
|
+
console.log(chalk.gray(" privacy: https://claudeusage.com/privacy"));
|
|
56
55
|
console.log("");
|
|
57
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
58
|
-
const answer = (await rl.question(chalk.bold("send aggregates? [y/N] ")))
|
|
59
|
-
.trim()
|
|
60
|
-
.toLowerCase();
|
|
61
|
-
rl.close();
|
|
62
|
-
return answer === "y" || answer === "yes";
|
|
63
56
|
}
|
|
64
57
|
function printDryRun(payload, records) {
|
|
65
58
|
const totals = payload.dailyBuckets.reduce((acc, bucket) => {
|
|
@@ -166,11 +159,7 @@ export async function runSync(options) {
|
|
|
166
159
|
writableConfig.apiBase = base;
|
|
167
160
|
writableConfig.token = token;
|
|
168
161
|
if (!writableConfig.consentAcceptedAt) {
|
|
169
|
-
|
|
170
|
-
if (!ok) {
|
|
171
|
-
console.log(chalk.yellow("aborted by user."));
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
162
|
+
printUploadNotice(payload.dailyBuckets.length, payload.sessionCount);
|
|
174
163
|
writableConfig.consentAcceptedAt = new Date().toISOString();
|
|
175
164
|
}
|
|
176
165
|
await writeConfig(writableConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudeusage-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Sync your Claude Code usage stats to claudeusage.com",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"main": "./dist/cli.js",
|
|
27
27
|
"bin": {
|
|
28
|
-
"claudeusage-sync": "
|
|
28
|
+
"claudeusage-sync": "bin/cli.js"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist/",
|