whoburnedmore 0.9.19 → 0.9.20

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ import { mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "node:f
11
11
  import { createRequire as createRequire4 } from "node:module";
12
12
  import { platform as platform4 } from "node:os";
13
13
  import { join as join15 } from "node:path";
14
+ import { pathToFileURL } from "node:url";
14
15
  import { createInterface } from "node:readline/promises";
15
16
  import pc2 from "picocolors";
16
17
 
@@ -7582,12 +7583,12 @@ async function fetchCursorEvents(cookie, maxPages = 30, pageSize = 500) {
7582
7583
  }
7583
7584
  return all;
7584
7585
  }
7585
- async function collectCursor() {
7586
+ async function collectCursor(opts) {
7586
7587
  try {
7587
7588
  const db = cursorDbPath();
7588
7589
  const token = db ? readCursorToken(db) : null;
7589
7590
  const cookie = token ? cursorCookie(token) : null;
7590
- if (cookie) {
7591
+ if (cookie && !opts?.offline) {
7591
7592
  const events = await fetchCursorEvents(cookie);
7592
7593
  const { entries, blocks } = mapCursorEvents(events);
7593
7594
  if (entries.length > 0) return { entries, blocks, found: true };
@@ -8413,8 +8414,10 @@ var COLLECT_STAGES = SOURCES.length + 4 + VSCODE_AGENTS.length + 1;
8413
8414
  function isAuthoritativeScan(attributionComplete, ...fingerprintReaders) {
8414
8415
  return attributionComplete && fingerprintReaders.every((reader) => reader.timedOut !== true);
8415
8416
  }
8416
- async function collectAll(onProgress) {
8417
- await loadLivePricing().catch(() => {
8417
+ async function collectAll(onProgress, opts) {
8418
+ await loadLivePricing(
8419
+ opts?.offline ? { ...process.env, WHOBURNEDMORE_PRICING_OFFLINE: "1" } : process.env
8420
+ ).catch(() => {
8418
8421
  });
8419
8422
  const { cmd, prefixArgs } = resolveCcusageBin();
8420
8423
  let done = 0;
@@ -8459,7 +8462,7 @@ async function collectAll(onProgress) {
8459
8462
  tick();
8460
8463
  return json ? mapCcusageBlocks(json) : [];
8461
8464
  });
8462
- const cursorTask = collectCursor().then((c) => {
8465
+ const cursorTask = collectCursor({ offline: opts?.offline }).then((c) => {
8463
8466
  tick();
8464
8467
  return c;
8465
8468
  });
@@ -8704,6 +8707,13 @@ function signedInNextStepLines(result) {
8704
8707
  ` \u2192 Get a friend on it \u2014 have them run: npx whoburnedmore --board=${sanitizeServerText(code)}`
8705
8708
  ];
8706
8709
  }
8710
+ if (result.needsSocial) {
8711
+ return [
8712
+ ` Your dashboard: ${sanitizeServerText(result.profileUrl)}`,
8713
+ " \u2192 You're synced, but not on the public leaderboard yet.",
8714
+ " \u2192 Add a social handle (X, GitHub, or Instagram) on your dashboard to appear."
8715
+ ];
8716
+ }
8707
8717
  return [
8708
8718
  ` Your dashboard: ${sanitizeServerText(result.profileUrl)}`,
8709
8719
  " \u2192 Open it to see your rank and share your profile."
@@ -9020,10 +9030,11 @@ function showLocalDashboard(payload) {
9020
9030
  file,
9021
9031
  renderDashboardHtml(payload.entries, /* @__PURE__ */ new Date(), { webBaseUrl: webBase() })
9022
9032
  );
9033
+ const fileUrl = pathToFileURL(file).href;
9023
9034
  console.log();
9024
- console.log(` Local dashboard: ${pc2.cyan(`file://${file}`)}`);
9035
+ console.log(` Local dashboard: ${pc2.cyan(fileUrl)}`);
9025
9036
  console.log(pc2.dim(" Re-run `npx whoburnedmore --local` to refresh it. Nothing left your machine."));
9026
- openBrowser(`file://${file}`);
9037
+ openBrowser(fileUrl);
9027
9038
  }
9028
9039
  async function run(flags) {
9029
9040
  if (!flags.quiet) {
@@ -9043,7 +9054,7 @@ async function run(flags) {
9043
9054
  } } : startProgress();
9044
9055
  let collected;
9045
9056
  try {
9046
- collected = await collectAll(progress.onProgress);
9057
+ collected = await collectAll(progress.onProgress, { offline: flags.local });
9047
9058
  } finally {
9048
9059
  progress.stop();
9049
9060
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whoburnedmore",
3
- "version": "0.9.19",
3
+ "version": "0.9.20",
4
4
  "description": "Find out who burned more — submit your AI coding-agent token usage to the public leaderboard at whoburnedmore.com",
5
5
  "type": "module",
6
6
  "bin": {