agent-limit 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. package/bin/cli.js +25 -0
  2. package/bin/cli.tsx +14 -24
  3. package/package.json +4 -3
package/bin/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "child_process";
4
+ import { dirname, join } from "path";
5
+ import { fileURLToPath } from "url";
6
+ import { existsSync } from "fs";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const bunPath = join(__dirname, "..", "node_modules", ".bin", "bun");
10
+ const cliPath = join(__dirname, "cli.tsx");
11
+
12
+ if (!existsSync(bunPath)) {
13
+ console.error("Error: bun not found at", bunPath);
14
+ console.error("Try running: npm install");
15
+ process.exit(1);
16
+ }
17
+
18
+ try {
19
+ execFileSync(bunPath, [cliPath, ...process.argv.slice(2)], {
20
+ stdio: "inherit",
21
+ env: { ...process.env, FORCE_COLOR: "1" },
22
+ });
23
+ } catch (err) {
24
+ process.exit(err.status ?? 1);
25
+ }
package/bin/cli.tsx CHANGED
@@ -1,54 +1,44 @@
1
1
  #!/usr/bin/env bun
2
2
  /** @jsxImportSource @opentui/react */
3
3
 
4
+ import { createCliRenderer } from "@opentui/core";
4
5
  import { createRoot } from "@opentui/react";
5
6
  import { App } from "../src/App";
6
7
 
7
- function resetTerminal() {
8
- process.stdout.write("\x1b[?1049l");
9
- process.stdout.write("\x1b[?25h");
10
- process.stdout.write("\x1b[0m");
11
- process.stdout.write("\x1b[?1000l");
12
- process.stdout.write("\x1b[?1002l");
13
- process.stdout.write("\x1b[?1003l");
14
- process.stdout.write("\x1b[?1006l");
15
- process.stdout.write("\x1b[?2004l");
16
- }
17
-
18
8
  const command = process.argv[2];
19
9
 
20
10
  if (command === "usage") {
21
- let root: ReturnType<typeof createRoot> | null = null;
11
+ const renderer = await createCliRenderer({
12
+ exitOnCtrlC: false,
13
+ });
14
+
15
+ const root = createRoot(renderer);
22
16
 
23
17
  const cleanup = () => {
24
- if (root) {
25
- root.unmount();
26
- }
27
- resetTerminal();
18
+ root.unmount();
19
+ renderer.destroy();
28
20
  process.exit(0);
29
21
  };
30
22
 
31
23
  process.on("SIGINT", cleanup);
32
24
  process.on("SIGTERM", cleanup);
33
- process.on("exit", resetTerminal);
34
25
 
35
- root = createRoot(process.stdout, { hideCursor: true });
36
26
  root.render(<App onExit={cleanup} />);
37
27
  } else if (command === "help" || command === "--help" || command === "-h" || !command) {
38
28
  console.log(`
39
- agent-monitor
29
+ agent-limit
40
30
 
41
31
  Monitor AI agent CLI usage limits in real-time.
42
32
 
43
33
  Install:
44
- npm install -g agent-monitor
34
+ npm install -g agent-limit
45
35
 
46
36
  Quick Start:
47
- agent-monitor usage
37
+ agent-limit usage
48
38
 
49
39
  CLI:
50
- agent-monitor usage Show usage dashboard
51
- agent-monitor help Show this help message
40
+ agent-limit usage Show usage dashboard
41
+ agent-limit help Show this help message
52
42
 
53
43
  Dashboard Controls:
54
44
  q Quit
@@ -56,6 +46,6 @@ Dashboard Controls:
56
46
  `);
57
47
  } else {
58
48
  console.error(`Unknown command: ${command}`);
59
- console.error(`Run 'agent-monitor help' for usage.`);
49
+ console.error(`Run 'agent-limit help' for usage.`);
60
50
  process.exit(1);
61
51
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "agent-limit",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Terminal dashboard to monitor Claude Code, Codex, and other agent usage limits",
5
5
  "type": "module",
6
6
  "main": "src/index.tsx",
7
7
  "bin": {
8
- "agent-limit": "./bin/cli.tsx"
8
+ "agent-limit": "bin/cli.js"
9
9
  },
10
10
  "scripts": {
11
11
  "start": "bun run src/index.tsx",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://github.com/AgentWorkforce/limit",
45
45
  "engines": {
46
- "bun": ">=1.0.0"
46
+ "node": ">=18.0.0"
47
47
  },
48
48
  "os": [
49
49
  "darwin"
@@ -51,6 +51,7 @@
51
51
  "dependencies": {
52
52
  "@opentui/core": "^0.1.67",
53
53
  "@opentui/react": "^0.1.63",
54
+ "bun": "^1.2.0",
54
55
  "react": "^19.0.0"
55
56
  },
56
57
  "devDependencies": {