agent-limit 0.6.2 → 0.7.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/README.md +52 -53
- package/bin/cli.tsx +44 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,35 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Terminal dashboard to monitor Claude Code and Codex usage limits.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
### Via npm (requires Bun)
|
|
5
|
+
## Quickstart
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
8
|
npm install -g agent-limit
|
|
9
|
+
agent-limit usage
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Download from [GitHub Releases](https://github.com/AgentWorkforce/limit/releases):
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Apple Silicon
|
|
19
|
-
curl -L https://github.com/AgentWorkforce/limit/releases/latest/download/agent-limit-darwin-arm64 -o /usr/local/bin/agent-limit
|
|
20
|
-
chmod +x /usr/local/bin/agent-limit
|
|
12
|
+
## Example
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
```
|
|
15
|
+
[███████░░░░|░░░░░░░░░] 30% ↓12%
|
|
16
|
+
^ you should be at 42%, but you're at 30% (12% under pace)
|
|
25
17
|
```
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
- `↓X%` (green) = under pace, you have headroom
|
|
20
|
+
- `↑X%` (red) = over pace, might hit limits early
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Real-time usage tracking for Claude Code and Codex
|
|
25
|
+
- Trajectory markers showing if you're ahead or behind your usage pace
|
|
26
|
+
- Auto-refresh every 60 seconds
|
|
27
|
+
- Color-coded usage indicators
|
|
32
28
|
|
|
33
|
-
## CLI
|
|
29
|
+
## CLI Reference
|
|
34
30
|
|
|
35
31
|
| Command | Description |
|
|
36
32
|
|---------|-------------|
|
|
@@ -38,20 +34,13 @@ agent-limit usage
|
|
|
38
34
|
| `agent-limit version` | Show version |
|
|
39
35
|
| `agent-limit help` | Show help message |
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
### Dashboard Controls
|
|
42
38
|
|
|
43
39
|
| Key | Action |
|
|
44
40
|
|-----|--------|
|
|
45
41
|
| `q` | Quit |
|
|
46
42
|
| `r` | Refresh |
|
|
47
43
|
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
- Real-time usage tracking for Claude Code and Codex
|
|
51
|
-
- Trajectory markers showing if you're ahead or behind your usage pace
|
|
52
|
-
- Auto-refresh every 60 seconds
|
|
53
|
-
- Color-coded usage indicators
|
|
54
|
-
|
|
55
44
|
## Supported Providers
|
|
56
45
|
|
|
57
46
|
| Provider | Status | Data Source |
|
|
@@ -59,6 +48,42 @@ agent-limit usage
|
|
|
59
48
|
| Claude Code | Full support | macOS Keychain + Anthropic API |
|
|
60
49
|
| Codex | Full support | `~/.codex/auth.json` + OpenAI API |
|
|
61
50
|
|
|
51
|
+
## How It Works
|
|
52
|
+
|
|
53
|
+
agent-limit reads credentials from standard locations:
|
|
54
|
+
|
|
55
|
+
- **Claude Code**: macOS Keychain (`Claude Code-credentials`)
|
|
56
|
+
- **Codex**: `~/.codex/auth.json`
|
|
57
|
+
|
|
58
|
+
It then fetches usage data from each provider's API and displays it in a unified dashboard.
|
|
59
|
+
|
|
60
|
+
## Installation Options
|
|
61
|
+
|
|
62
|
+
### Via npm
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -g agent-limit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Standalone Binary (no dependencies)
|
|
69
|
+
|
|
70
|
+
Download from [GitHub Releases](https://github.com/AgentWorkforce/limit/releases):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Apple Silicon
|
|
74
|
+
curl -L https://github.com/AgentWorkforce/limit/releases/latest/download/agent-limit-darwin-arm64 -o /usr/local/bin/agent-limit
|
|
75
|
+
chmod +x /usr/local/bin/agent-limit
|
|
76
|
+
|
|
77
|
+
# Intel Mac
|
|
78
|
+
curl -L https://github.com/AgentWorkforce/limit/releases/latest/download/agent-limit-darwin-x64 -o /usr/local/bin/agent-limit
|
|
79
|
+
chmod +x /usr/local/bin/agent-limit
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Requirements
|
|
83
|
+
|
|
84
|
+
- macOS (uses Keychain for credential storage)
|
|
85
|
+
- Active CLI authentication for providers you want to monitor
|
|
86
|
+
|
|
62
87
|
## Development
|
|
63
88
|
|
|
64
89
|
```bash
|
|
@@ -96,32 +121,6 @@ bun run build:x64 # Intel
|
|
|
96
121
|
|
|
97
122
|
Binaries are output to `dist/`.
|
|
98
123
|
|
|
99
|
-
## How It Works
|
|
100
|
-
|
|
101
|
-
agent-limit reads credentials from standard locations:
|
|
102
|
-
|
|
103
|
-
- **Claude Code**: macOS Keychain (`Claude Code-credentials`)
|
|
104
|
-
- **Codex**: `~/.codex/auth.json`
|
|
105
|
-
|
|
106
|
-
It then fetches usage data from each provider's API and displays it in a unified dashboard.
|
|
107
|
-
|
|
108
|
-
### Trajectory Indicator
|
|
109
|
-
|
|
110
|
-
Each progress bar shows a `|` marker indicating where your usage "should be" based on time elapsed in the reset period:
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
[███████░░░░|░░░░░░░░░] 30% ↓12%
|
|
114
|
-
^ you should be at 42%, but you're at 30% (12% under pace)
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
- `↓X%` (green) = under pace, you have headroom
|
|
118
|
-
- `↑X%` (red) = over pace, might hit limits early
|
|
119
|
-
|
|
120
|
-
## Requirements
|
|
121
|
-
|
|
122
|
-
- macOS (uses Keychain for credential storage)
|
|
123
|
-
- Active CLI authentication for providers you want to monitor
|
|
124
|
-
|
|
125
124
|
## License
|
|
126
125
|
|
|
127
126
|
MIT
|
package/bin/cli.tsx
CHANGED
|
@@ -14,9 +14,10 @@ if (command === "usage") {
|
|
|
14
14
|
|
|
15
15
|
const root = createRoot(renderer);
|
|
16
16
|
|
|
17
|
-
const cleanup = () => {
|
|
17
|
+
const cleanup = async () => {
|
|
18
18
|
root.unmount();
|
|
19
|
-
renderer.destroy();
|
|
19
|
+
await renderer.destroy();
|
|
20
|
+
process.stdout.write("\x1b[?25h"); // Ensure cursor is visible
|
|
20
21
|
process.exit(0);
|
|
21
22
|
};
|
|
22
23
|
|
|
@@ -27,6 +28,46 @@ if (command === "usage") {
|
|
|
27
28
|
} else if (command === "version" || command === "--version" || command === "-v") {
|
|
28
29
|
const pkg = await import("../package.json");
|
|
29
30
|
console.log(pkg.version);
|
|
31
|
+
} else if (command === "update") {
|
|
32
|
+
const pkg = await import("../package.json");
|
|
33
|
+
const currentVersion = pkg.version;
|
|
34
|
+
|
|
35
|
+
console.log(`Current version: ${currentVersion}`);
|
|
36
|
+
console.log("Checking for updates...");
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch("https://registry.npmjs.org/agent-limit/latest");
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
throw new Error(`Failed to fetch: ${response.status}`);
|
|
42
|
+
}
|
|
43
|
+
const data = await response.json() as { version: string };
|
|
44
|
+
const latestVersion = data.version;
|
|
45
|
+
|
|
46
|
+
if (latestVersion === currentVersion) {
|
|
47
|
+
console.log(`✓ You're on the latest version (${currentVersion})`);
|
|
48
|
+
} else {
|
|
49
|
+
console.log(`New version available: ${latestVersion}`);
|
|
50
|
+
console.log("\nUpdating...");
|
|
51
|
+
|
|
52
|
+
const proc = Bun.spawn(["npm", "install", "-g", "agent-limit@latest"], {
|
|
53
|
+
stdout: "inherit",
|
|
54
|
+
stderr: "inherit",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const exitCode = await proc.exited;
|
|
58
|
+
|
|
59
|
+
if (exitCode === 0) {
|
|
60
|
+
console.log(`\n✓ Updated to ${latestVersion}`);
|
|
61
|
+
} else {
|
|
62
|
+
console.error("\n✗ Update failed. Try running manually:");
|
|
63
|
+
console.error(" npm install -g agent-limit@latest");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Failed to check for updates:", error instanceof Error ? error.message : error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
30
71
|
} else if (command === "help" || command === "--help" || command === "-h" || !command) {
|
|
31
72
|
console.log(`
|
|
32
73
|
agent-limit
|
|
@@ -41,6 +82,7 @@ Quick Start:
|
|
|
41
82
|
|
|
42
83
|
CLI:
|
|
43
84
|
agent-limit usage Show usage dashboard
|
|
85
|
+
agent-limit update Update to latest version
|
|
44
86
|
agent-limit version Show version
|
|
45
87
|
agent-limit help Show this help message
|
|
46
88
|
|