gusage 1.1.2 → 1.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/README.md CHANGED
@@ -67,6 +67,7 @@ gusage --json --watch 5s | jq .
67
67
  - `-n, --notify [threshold]`: Send a desktop notification when a model drops below the threshold percent (default: `20`). Requires `--watch`.
68
68
  - `-j, --json`: Output raw JSON instead of a table. Can be combined with `--watch` for streaming data.
69
69
  - `--no-color`: Disable color output (also respects `NO_COLOR` env var).
70
+ - `-v, --version`: Show version.
70
71
 
71
72
  ## Requirements
72
73
 
package/dist/index.js CHANGED
@@ -8,6 +8,55 @@ import os from "os";
8
8
  import crypto from "crypto";
9
9
  import { parseArgs } from "util";
10
10
  import { execSync, spawn } from "child_process";
11
+ // package.json
12
+ var package_default = {
13
+ name: "gusage",
14
+ version: "1.2.0",
15
+ description: "A standalone CLI to export Gemini CLI quota and usage statistics",
16
+ module: "index.ts",
17
+ type: "module",
18
+ bin: {
19
+ gusage: "dist/index.js"
20
+ },
21
+ files: [
22
+ "dist/index.js",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ author: "Abdellah Hariti <haritiabdellah@gmail.com>",
27
+ license: "MIT",
28
+ private: false,
29
+ scripts: {
30
+ format: "prettier --write .",
31
+ prepare: "husky",
32
+ build: "bun build ./index.ts --outfile dist/index.js && chmod +x dist/index.js",
33
+ prepack: "bun run build"
34
+ },
35
+ "lint-staged": {
36
+ "*": "prettier --write --ignore-unknown",
37
+ "*.ts": "bash -c 'bun x tsc --noEmit'"
38
+ },
39
+ devDependencies: {
40
+ "@types/bun": "latest",
41
+ husky: "^9.1.7",
42
+ "lint-staged": "^16.2.7",
43
+ prettier: "^3.8.1"
44
+ },
45
+ peerDependencies: {
46
+ typescript: "^5"
47
+ },
48
+ keywords: [
49
+ "gemini-cli",
50
+ "gemini",
51
+ "google-gemini",
52
+ "quota",
53
+ "usage",
54
+ "stats",
55
+ "monitoring"
56
+ ]
57
+ };
58
+
59
+ // index.ts
11
60
  var OAUTH_CLIENT_ID = "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com";
12
61
  var OAUTH_CLIENT_SECRET = "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";
13
62
  var CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
@@ -140,6 +189,7 @@ function padVisual(str, width, side = "right") {
140
189
  return side === "right" ? str + pad : pad + str;
141
190
  }
142
191
  async function main() {
192
+ const packageVersion = package_default.version;
143
193
  const args = Bun.argv.slice(2);
144
194
  const watchIdx = args.findIndex((a) => a === "--watch" || a === "-w");
145
195
  if (watchIdx !== -1 && (watchIdx === args.length - 1 || args[watchIdx + 1].startsWith("-"))) {
@@ -153,6 +203,7 @@ async function main() {
153
203
  args,
154
204
  options: {
155
205
  help: { type: "boolean", short: "h" },
206
+ version: { type: "boolean", short: "v" },
156
207
  json: { type: "boolean", short: "j" },
157
208
  "no-color": { type: "boolean" },
158
209
  watch: { type: "string", short: "w" },
@@ -166,6 +217,7 @@ Usage: gusage [options]
166
217
 
167
218
  Options:
168
219
  -h, --help Show this help message
220
+ -v, --version Show version and exit
169
221
  -w, --watch [interval] Update live every interval (default: 10s).
170
222
  Supports combined units: 20s, 5m, 1m20s.
171
223
  -n, --notify [threshold] Show a critical OS notification if any model falls below
@@ -175,6 +227,10 @@ Options:
175
227
  `);
176
228
  return;
177
229
  }
230
+ if (values.version) {
231
+ console.log(packageVersion);
232
+ return;
233
+ }
178
234
  const isWatching = values.watch !== undefined;
179
235
  const isJson = values.json === true;
180
236
  let intervalMs = 1e4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gusage",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "A standalone CLI to export Gemini CLI quota and usage statistics",
5
5
  "module": "index.ts",
6
6
  "type": "module",