Skip to content

Commit 67182bd

Browse files
committed
v0.4.0: Add bun as dependency, fix CLI renderer API
1 parent 029ac5b commit 67182bd

File tree

5 files changed

+1396
-28
lines changed

5 files changed

+1396
-28
lines changed

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.4.0] - 2025-01-02
11+
12+
### Added
13+
14+
- Bun as npm dependency - no global Bun installation required
15+
- Node.js wrapper script for npm distribution
16+
17+
### Fixed
18+
19+
- CLI now uses correct @opentui/core API (createCliRenderer)
20+
21+
### Changed
22+
23+
- Renamed package from `agent-monitor` to `agent-limit`
24+
1025
## [0.3.0] - 2025-01-02
1126

1227
### Added
@@ -40,7 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4055
- Standalone binary builds for macOS (arm64 and x64)
4156
- npm package distribution
4257

43-
[Unreleased]: https://github.com/AgentWorkforce/limit/compare/v0.3.0...HEAD
58+
[Unreleased]: https://github.com/AgentWorkforce/limit/compare/v0.4.0...HEAD
59+
[0.4.0]: https://github.com/AgentWorkforce/limit/compare/v0.3.0...v0.4.0
4460
[0.3.0]: https://github.com/AgentWorkforce/limit/compare/v0.2.0...v0.3.0
4561
[0.2.0]: https://github.com/AgentWorkforce/limit/compare/v0.1.0...v0.2.0
4662
[0.1.0]: https://github.com/AgentWorkforce/limit/releases/tag/v0.1.0

bin/cli.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

bin/cli.tsx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,51 @@
11
#!/usr/bin/env bun
22
/** @jsxImportSource @opentui/react */
33

4+
import { createCliRenderer } from "@opentui/core";
45
import { createRoot } from "@opentui/react";
56
import { App } from "../src/App";
67

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-
188
const command = process.argv[2];
199

2010
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);
2216

2317
const cleanup = () => {
24-
if (root) {
25-
root.unmount();
26-
}
27-
resetTerminal();
18+
root.unmount();
19+
renderer.destroy();
2820
process.exit(0);
2921
};
3022

3123
process.on("SIGINT", cleanup);
3224
process.on("SIGTERM", cleanup);
33-
process.on("exit", resetTerminal);
3425

35-
root = createRoot(process.stdout, { hideCursor: true });
3626
root.render(<App onExit={cleanup} />);
3727
} else if (command === "help" || command === "--help" || command === "-h" || !command) {
3828
console.log(`
39-
agent-monitor
29+
agent-limit
4030
4131
Monitor AI agent CLI usage limits in real-time.
4232
4333
Install:
44-
npm install -g agent-monitor
34+
npm install -g agent-limit
4535
4636
Quick Start:
47-
agent-monitor usage
37+
agent-limit usage
4838
4939
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
5242
5343
Dashboard Controls:
5444
q Quit
5545
r Refresh
5646
`);
5747
} else {
5848
console.error(`Unknown command: ${command}`);
59-
console.error(`Run 'agent-monitor help' for usage.`);
49+
console.error(`Run 'agent-limit help' for usage.`);
6050
process.exit(1);
6151
}

0 commit comments

Comments
 (0)