awarts 0.2.4 → 0.2.6

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 +33 -1
  2. package/package.json +9 -11
package/dist/index.js CHANGED
@@ -7224,9 +7224,41 @@ async function daemonRunLoop(intervalMs) {
7224
7224
  }
7225
7225
  }
7226
7226
 
7227
+ // src/lib/version-check.ts
7228
+ import { readFileSync } from "node:fs";
7229
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
7230
+ import { dirname, join } from "node:path";
7231
+ var __dirname3 = dirname(fileURLToPath2(import.meta.url));
7232
+ function getLocalVersion() {
7233
+ try {
7234
+ const pkg = JSON.parse(readFileSync(join(__dirname3, "..", "package.json"), "utf-8"));
7235
+ return pkg.version ?? "0.0.0";
7236
+ } catch {
7237
+ return "0.0.0";
7238
+ }
7239
+ }
7240
+ async function checkForUpdates() {
7241
+ try {
7242
+ const controller = new AbortController;
7243
+ const timeout = setTimeout(() => controller.abort(), 3000);
7244
+ const res = await fetch("https://registry.npmjs.org/awarts/latest", {
7245
+ signal: controller.signal
7246
+ });
7247
+ clearTimeout(timeout);
7248
+ if (!res.ok)
7249
+ return;
7250
+ const data = await res.json();
7251
+ const latest = data.version;
7252
+ const current = getLocalVersion();
7253
+ if (latest && latest !== current) {
7254
+ info(`Update available: ${current} → ${latest}. Run: npm i -g awarts@latest`);
7255
+ }
7256
+ } catch {}
7257
+ }
7258
+
7227
7259
  // src/index.ts
7228
7260
  var program2 = new Command;
7229
- program2.name("awarts").description("Track your AI coding spend across Claude, Codex, Gemini & Antigravity").version("0.1.0");
7261
+ program2.name("awarts").description("Track your AI coding spend across Claude, Codex, Gemini & Antigravity").version("0.2.5").hook("preAction", () => checkForUpdates());
7230
7262
  program2.command("login").description("Authenticate with your AWARTS account via device auth").option("--force", "Re-authenticate even if already logged in").action(async (opts) => {
7231
7263
  try {
7232
7264
  if (opts.force) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awarts",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Track your AI coding across Claude, Codex, Gemini & Antigravity",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,25 +36,23 @@
36
36
  "README.md",
37
37
  "LICENSE"
38
38
  ],
39
+ "sideEffects": false,
39
40
  "scripts": {
40
41
  "dev": "bun --watch src/index.ts",
41
42
  "build": "bun build src/index.ts --outdir dist --target node",
42
- "prepublishOnly": "bun run build",
43
43
  "test": "vitest run",
44
44
  "test:watch": "vitest"
45
45
  },
46
- "dependencies": {
46
+ "devDependencies": {
47
+ "@types/node": "^22.16.0",
47
48
  "chalk": "^5.4.0",
48
- "ora": "^8.2.0",
49
- "open": "^10.1.0",
50
49
  "commander": "^13.1.0",
51
50
  "jose": "^5.10.0",
52
- "nanoid": "^5.1.0"
53
- },
54
- "devDependencies": {
55
- "@types/node": "^22.16.0",
56
- "vitest": "^3.2.0",
57
- "typescript": "^5.8.0"
51
+ "nanoid": "^5.1.0",
52
+ "open": "^10.1.0",
53
+ "ora": "^8.2.0",
54
+ "typescript": "^5.8.0",
55
+ "vitest": "^3.2.0"
58
56
  },
59
57
  "engines": {
60
58
  "node": ">=18.0.0"