claudeusage-sync 0.1.0 → 0.2.1

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.
@@ -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";
@@ -9,7 +8,7 @@ import { readPackageInfo } from "../package.js";
9
8
  import { dedupe, detectOutputTokenUndercount, recordWatermarkKey, } from "../parse/dedupe.js";
10
9
  import { streamAllRecords } from "../parse/jsonl.js";
11
10
  import { resolveClaudeDir } from "../parse/paths.js";
12
- const DEFAULT_API = "https://claudeusage.com";
11
+ const DEFAULT_API = "https://www.claudeusage.com";
13
12
  const packageInfo = readPackageInfo(import.meta.url);
14
13
  function apiBase() {
15
14
  return (process.env.CLAUDEUSAGE_API ?? DEFAULT_API).replace(/\/$/, "");
@@ -43,23 +42,17 @@ async function readRecords() {
43
42
  }
44
43
  return records;
45
44
  }
46
- async function confirmConsent(dayCount, sessionCount) {
47
- if (process.env.CLAUDEUSAGE_ASSUME_YES === "1") {
48
- return true;
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("first-time sync - what will be uploaded:"));
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(` ${chalk.gray("no prompts, responses, file paths, project names, or raw JSONL files are uploaded")}`);
55
- console.log(` ${chalk.gray("privacy: https://claudeusage.com/privacy")}`);
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
- const ok = await confirmConsent(payload.dailyBuckets.length, payload.sessionCount);
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.1.0",
3
+ "version": "0.2.1",
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": "./bin/cli.js"
28
+ "claudeusage-sync": "bin/cli.js"
29
29
  },
30
30
  "files": [
31
31
  "dist/",