claude-quota-bar 0.0.0-bootstrap

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/bin.js +67 -0
  2. package/package.json +40 -0
package/bin.js ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ // Umbrella launcher: locates the platform-specific package installed via
3
+ // optionalDependencies and exec's its binary. Falls through to a clear
4
+ // error if the user is on an unsupported platform or the platform package
5
+ // failed to install (network, permissions).
6
+
7
+ "use strict";
8
+
9
+ const { spawnSync } = require("child_process");
10
+ const path = require("path");
11
+ const fs = require("fs");
12
+
13
+ function detectLibc() {
14
+ // Best-effort musl vs glibc detection on Linux. Alpine and other musl
15
+ // distros ship /lib/ld-musl-* loaders; glibc has /lib*/libc.so.6 etc.
16
+ if (process.platform !== "linux") return "gnu";
17
+ try {
18
+ const entries = fs.readdirSync("/lib");
19
+ if (entries.some((e) => e.startsWith("ld-musl-"))) return "musl";
20
+ } catch {}
21
+ return "gnu";
22
+ }
23
+
24
+ function packageName() {
25
+ const { platform, arch } = process;
26
+ if (platform === "darwin" && arch === "arm64") return "claude-quota-bar-darwin-arm64";
27
+ if (platform === "darwin" && arch === "x64") return "claude-quota-bar-darwin-x64";
28
+ if (platform === "win32" && arch === "x64") return "claude-quota-bar-win32-x64";
29
+ if (platform === "linux") {
30
+ const libc = detectLibc();
31
+ if (arch === "x64") return libc === "musl"
32
+ ? "claude-quota-bar-linux-x64-musl"
33
+ : "claude-quota-bar-linux-x64";
34
+ if (arch === "arm64") return libc === "musl"
35
+ ? "claude-quota-bar-linux-arm64-musl"
36
+ : "claude-quota-bar-linux-arm64";
37
+ }
38
+ return null;
39
+ }
40
+
41
+ const pkg = packageName();
42
+ if (!pkg) {
43
+ console.error(
44
+ `claude-quota-bar: unsupported platform ${process.platform}/${process.arch}. ` +
45
+ "Download a binary from https://github.com/xrf9268-hue/claude-quota-bar/releases."
46
+ );
47
+ process.exit(1);
48
+ }
49
+
50
+ const binName = process.platform === "win32" ? "claude-quota-bar.exe" : "claude-quota-bar";
51
+ let binPath;
52
+ try {
53
+ binPath = require.resolve(`${pkg}/bin/${binName}`);
54
+ } catch {
55
+ console.error(
56
+ `claude-quota-bar: platform package ${pkg} is not installed.\n` +
57
+ "Try reinstalling: npm install -g claude-quota-bar"
58
+ );
59
+ process.exit(1);
60
+ }
61
+
62
+ const result = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
63
+ if (result.error) {
64
+ console.error(`claude-quota-bar: ${result.error.message}`);
65
+ process.exit(1);
66
+ }
67
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "claude-quota-bar",
3
+ "version": "0.0.0-bootstrap",
4
+ "description": "Fast Rust statusline for Claude Code — battery-bar 5h/7d quota, ctx, cache age, git",
5
+ "keywords": [
6
+ "claude",
7
+ "statusline",
8
+ "cli",
9
+ "terminal",
10
+ "anthropic"
11
+ ],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/xrf9268-hue/claude-quota-bar.git"
16
+ },
17
+ "homepage": "https://github.com/xrf9268-hue/claude-quota-bar",
18
+ "bugs": {
19
+ "url": "https://github.com/xrf9268-hue/claude-quota-bar/issues"
20
+ },
21
+ "bin": {
22
+ "claude-quota-bar": "./bin.js"
23
+ },
24
+ "files": [
25
+ "bin.js",
26
+ "README.md"
27
+ ],
28
+ "engines": {
29
+ "node": ">=16"
30
+ },
31
+ "optionalDependencies": {
32
+ "claude-quota-bar-darwin-arm64": "0.0.0-bootstrap",
33
+ "claude-quota-bar-darwin-x64": "0.0.0-bootstrap",
34
+ "claude-quota-bar-linux-x64": "0.0.0-bootstrap",
35
+ "claude-quota-bar-linux-x64-musl": "0.0.0-bootstrap",
36
+ "claude-quota-bar-linux-arm64": "0.0.0-bootstrap",
37
+ "claude-quota-bar-linux-arm64-musl": "0.0.0-bootstrap",
38
+ "claude-quota-bar-win32-x64": "0.0.0-bootstrap"
39
+ }
40
+ }