Skip to content

Commit 8264230

Browse files
committed
Add update` command to check for and install latest version
1 parent 9ec69b6 commit 8264230

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Agent Instructions
2+
3+
Guidelines for AI agents working on this codebase.
4+
5+
## Version Management
6+
7+
When you complete a task that changes functionality:
8+
9+
1. **Bump the version** in `package.json` following [Semantic Versioning](https://semver.org/):
10+
- **MAJOR** (1.0.0): Breaking changes
11+
- **MINOR** (0.1.0): New features, backwards compatible
12+
- **PATCH** (0.0.1): Bug fixes, backwards compatible
13+
14+
2. **Update the changelog** in `CHANGELOG.md`:
15+
- Add entry under `## [X.Y.Z] - YYYY-MM-DD`
16+
- Use appropriate section: `Added`, `Changed`, `Fixed`, `Removed`
17+
- Update the version comparison links at the bottom

CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [0.7.0] - 2026-01-02
11+
12+
### Added
13+
14+
- `update` command to check for and install latest version (`agent-limit update`)
15+
1016
## [0.6.2] - 2026-01-02
1117

1218
### Fixed
@@ -87,7 +93,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8793
- Standalone binary builds for macOS (arm64 and x64)
8894
- npm package distribution
8995

90-
[Unreleased]: https://github.com/AgentWorkforce/limit/compare/v0.6.2...HEAD
96+
[Unreleased]: https://github.com/AgentWorkforce/limit/compare/v0.7.0...HEAD
97+
[0.7.0]: https://github.com/AgentWorkforce/limit/compare/v0.6.2...v0.7.0
9198
[0.6.2]: https://github.com/AgentWorkforce/limit/compare/v0.6.0...v0.6.2
9299
[0.6.0]: https://github.com/AgentWorkforce/limit/compare/v0.5.1...v0.6.0
93100
[0.5.1]: https://github.com/AgentWorkforce/limit/compare/v0.5.0...v0.5.1

bin/cli.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,46 @@ if (command === "usage") {
2727
} else if (command === "version" || command === "--version" || command === "-v") {
2828
const pkg = await import("../package.json");
2929
console.log(pkg.version);
30+
} else if (command === "update") {
31+
const pkg = await import("../package.json");
32+
const currentVersion = pkg.version;
33+
34+
console.log(`Current version: ${currentVersion}`);
35+
console.log("Checking for updates...");
36+
37+
try {
38+
const response = await fetch("https://registry.npmjs.org/agent-limit/latest");
39+
if (!response.ok) {
40+
throw new Error(`Failed to fetch: ${response.status}`);
41+
}
42+
const data = await response.json() as { version: string };
43+
const latestVersion = data.version;
44+
45+
if (latestVersion === currentVersion) {
46+
console.log(`✓ You're on the latest version (${currentVersion})`);
47+
} else {
48+
console.log(`New version available: ${latestVersion}`);
49+
console.log("\nUpdating...");
50+
51+
const proc = Bun.spawn(["npm", "install", "-g", "agent-limit@latest"], {
52+
stdout: "inherit",
53+
stderr: "inherit",
54+
});
55+
56+
const exitCode = await proc.exited;
57+
58+
if (exitCode === 0) {
59+
console.log(`\n✓ Updated to ${latestVersion}`);
60+
} else {
61+
console.error("\n✗ Update failed. Try running manually:");
62+
console.error(" npm install -g agent-limit@latest");
63+
process.exit(1);
64+
}
65+
}
66+
} catch (error) {
67+
console.error("Failed to check for updates:", error instanceof Error ? error.message : error);
68+
process.exit(1);
69+
}
3070
} else if (command === "help" || command === "--help" || command === "-h" || !command) {
3171
console.log(`
3272
agent-limit
@@ -41,6 +81,7 @@ Quick Start:
4181
4282
CLI:
4383
agent-limit usage Show usage dashboard
84+
agent-limit update Update to latest version
4485
agent-limit version Show version
4586
agent-limit help Show this help message
4687

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "agent-limit",
3-
"version": "0.6.2",
3+
"version": "0.7.0",
44
"description": "Terminal dashboard to monitor Claude Code, Codex, and other agent usage limits",
55
"type": "module",
66
"main": "src/index.tsx",

0 commit comments

Comments
 (0)