tokenmaxxing 0.1.0 → 0.2.1

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/src/main.ts ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env bun
2
+ // Single multi-call binary. Behaves as the `claude` supervisor when invoked as
3
+ // `claude` (or `__supervise`), routes hook/statusLine subcommands, and otherwise
4
+ // dispatches the `tokenmaxxing` CLI.
5
+
6
+ import { basename } from "node:path";
7
+ import { runSupervisor } from "./entries/supervisor.ts";
8
+ import { runStatusline } from "./entries/statusline.ts";
9
+ import { runStopHook } from "./entries/stophook.ts";
10
+ import { runSessionStart } from "./entries/sessionstart.ts";
11
+ import { cmdInit } from "./cli/init.ts";
12
+ import { cmdAdd } from "./cli/add.ts";
13
+ import { cmdLs } from "./cli/ls.ts";
14
+ import { cmdStatus } from "./cli/status.ts";
15
+ import { cmdDoctor } from "./cli/doctor.ts";
16
+ import { cmdRm } from "./cli/rm.ts";
17
+ import { cmdRename } from "./cli/rename.ts";
18
+ import { cmdSwitch } from "./cli/switch.ts";
19
+ import { uninstallSupervisor } from "./lib/install.ts";
20
+ import { c } from "./cli/render.ts";
21
+
22
+ function printHelp(): void {
23
+ console.log(`${c.bold("tokenmaxxing")} - automatic Claude Code account switching
24
+
25
+ ${c.cyan("tokenmaxxing")} show the pool with usage bars (alias of ${c.cyan("status")})
26
+ ${c.cyan("tokenmaxxing switch")} [sel] switch now to the best (or a specific) account
27
+ ${c.cyan("tokenmaxxing init")} import the current account + install supervisor & hooks
28
+ ${c.cyan("tokenmaxxing add")} register an additional account (isolated login)
29
+ ${c.cyan("tokenmaxxing ls")} list pooled accounts
30
+ ${c.cyan("tokenmaxxing status")} accounts with 5h / weekly / per-model usage bars
31
+ ${c.cyan("tokenmaxxing doctor")} verify the install is intact
32
+ ${c.cyan("tokenmaxxing rename")} <sel> <label>
33
+ ${c.cyan("tokenmaxxing rm")} <sel>
34
+ ${c.cyan("tokenmaxxing uninstall")} remove supervisor + settings entries
35
+
36
+ ${c.dim("(aliased as")} ${c.cyan("xx")}${c.dim(")")} - then just run ${c.bold("claude")} as always; it switches accounts near quota automatically.`);
37
+ }
38
+
39
+ async function main(): Promise<number> {
40
+ if (process.platform !== "darwin" && process.platform !== "linux") {
41
+ console.error(`tokenmaxxing supports macOS and Linux only (this is ${process.platform})`);
42
+ return 1;
43
+ }
44
+ const args = process.argv.slice(2);
45
+ const argv0 = basename(process.argv0 || process.argv[0] || "");
46
+ const sub = args[0];
47
+
48
+ // supervisor mode: invoked as `claude`, or explicit `__supervise`
49
+ if (argv0 === "claude" || sub === "__supervise") {
50
+ return runSupervisor(sub === "__supervise" ? args.slice(1) : args);
51
+ }
52
+
53
+ switch (sub) {
54
+ case "__statusline": return runStatusline();
55
+ case "__stop-hook": return runStopHook();
56
+ case "__session-start": return runSessionStart();
57
+ case undefined: return cmdStatus(); // bare `tokenmaxxing` / `xx` → status
58
+ case "switch": return cmdSwitch(args[1]);
59
+ case "init": return cmdInit();
60
+ case "add": return cmdAdd();
61
+ case "ls": return cmdLs();
62
+ case "status": return cmdStatus();
63
+ case "doctor": return cmdDoctor();
64
+ case "rm": return cmdRm(args[1]);
65
+ case "rename": return cmdRename(args[1], args[2]);
66
+ case "uninstall":
67
+ uninstallSupervisor();
68
+ console.log("removed supervisor wrapper + settings entries (accounts/credentials kept)");
69
+ return 0;
70
+ case "help":
71
+ case "-h":
72
+ case "--help":
73
+ printHelp();
74
+ return 0;
75
+ default:
76
+ console.error(c.red(`unknown command: ${sub}`));
77
+ printHelp();
78
+ return 2;
79
+ }
80
+ }
81
+
82
+ process.exit(await main());
package/dist/index.js DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/index.ts
4
- var args = process.argv.slice(2);
5
- var command = args[0];
6
- function printHelp() {
7
- console.log(`
8
- tokenmaxxing - CLI
9
-
10
- Usage:
11
- tokenmaxxing <command>
12
-
13
- Commands:
14
- help Show this help message
15
- version Show version
16
-
17
- Options:
18
- --help, -h Show help
19
- --version, -v Show version
20
- `);
21
- }
22
- function printVersion() {
23
- console.log("tokenmaxxing v0.1.0");
24
- }
25
- switch (command) {
26
- case "version":
27
- case "--version":
28
- case "-v":
29
- printVersion();
30
- break;
31
- case "help":
32
- case "--help":
33
- case "-h":
34
- case undefined:
35
- default:
36
- printHelp();
37
- break;
38
- }