whoburnedmore 0.8.1 → 0.8.3

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 +21 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24,6 +24,15 @@ function parseBoard(args) {
24
24
  }
25
25
  return void 0;
26
26
  }
27
+ function resolveCommand(args) {
28
+ if (args.includes("--help") || args.includes("-h") || args.includes("help")) {
29
+ return "help";
30
+ }
31
+ if (args.includes("--version") || args.includes("-v") || args.includes("version")) {
32
+ return "version";
33
+ }
34
+ return args.find((a) => !a.startsWith("-")) ?? "run";
35
+ }
27
36
 
28
37
  // src/api.ts
29
38
  function apiBase() {
@@ -101,7 +110,13 @@ import { fileURLToPath } from "node:url";
101
110
 
102
111
  // src/config.ts
103
112
  import { randomBytes } from "node:crypto";
104
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
113
+ import {
114
+ chmodSync,
115
+ existsSync,
116
+ mkdirSync,
117
+ readFileSync,
118
+ writeFileSync
119
+ } from "node:fs";
105
120
  import { homedir } from "node:os";
106
121
  import { join } from "node:path";
107
122
  function defaultConfigDir() {
@@ -123,6 +138,10 @@ function saveConfig(dir = defaultConfigDir(), config = {}) {
123
138
  mkdirSync(dir, { recursive: true });
124
139
  const file = join(dir, "config.json");
125
140
  writeFileSync(file, JSON.stringify(config, null, 2), { mode: 384 });
141
+ try {
142
+ chmodSync(file, 384);
143
+ } catch {
144
+ }
126
145
  }
127
146
  function ensureAnonKey(dir = defaultConfigDir()) {
128
147
  const config = loadConfig(dir) ?? {};
@@ -5779,7 +5798,7 @@ async function main() {
5779
5798
  return;
5780
5799
  }
5781
5800
  const args = process.argv.slice(2);
5782
- const command = args.find((a) => !a.startsWith("-")) ?? (args.includes("--version") || args.includes("-v") ? "version" : "run");
5801
+ const command = resolveCommand(args);
5783
5802
  const flags = {
5784
5803
  dryRun: args.includes("--dry-run"),
5785
5804
  noSubmit: args.includes("--no-submit"),
@@ -5826,12 +5845,9 @@ async function main() {
5826
5845
  console.log(` ${uninstallAutoSync()}`);
5827
5846
  break;
5828
5847
  case "help":
5829
- case "--help":
5830
5848
  printHelp();
5831
5849
  break;
5832
5850
  case "version":
5833
- case "--version":
5834
- case "-v":
5835
5851
  console.log(VERSION);
5836
5852
  break;
5837
5853
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whoburnedmore",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
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": {