ai-burnrate-tool 1.0.0 β 1.0.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 +10 -66
- package/dist/cli/index.js +11 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,69 +26,23 @@ Track in real time how many tokens you are consuming across **Antigravity CLI**
|
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
## π Quick Install (
|
|
29
|
+
## π Quick Install (Windows / macOS / Linux)
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Install globally from npm using **one command** from any terminal:
|
|
32
32
|
|
|
33
33
|
> β οΈ **Prerequisite:** Make sure you have [Node.js (>= 18)](https://nodejs.org/) and `npm` installed.
|
|
34
34
|
|
|
35
|
-
###
|
|
36
|
-
Open PowerShell and run:
|
|
37
|
-
```powershell
|
|
38
|
-
irm https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/install.ps1 | iex
|
|
39
|
-
```
|
|
40
|
-
> π‘ **Note on Windows permissions:** If PowerShell blocks the script with an `ExecutionPolicy` or permission error, enable script execution for your user by running:
|
|
41
|
-
> ```powershell
|
|
42
|
-
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
43
|
-
> ```
|
|
44
|
-
|
|
45
|
-
### π macOS / π§ Linux (Bash / Zsh)
|
|
46
|
-
Open your terminal and run:
|
|
47
|
-
```bash
|
|
48
|
-
curl -fsSL https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/install.sh | bash
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### π¦ Universal Alternative via `npm` (Cross-Platform)
|
|
35
|
+
### Latest Version
|
|
52
36
|
```bash
|
|
53
|
-
npm install -g
|
|
37
|
+
npm install -g ai-burnrate-tool
|
|
54
38
|
```
|
|
55
39
|
|
|
56
|
-
*(Want to run it once without installing? Use `npx
|
|
57
|
-
|
|
58
|
-
### π·οΈ Install a Specific Release Version
|
|
59
|
-
To pin a specific release tag (e.g., `v1.0.1`), use the release tarball directly or pass `BURNRATE_VERSION` to the installer:
|
|
40
|
+
*(Want to run it once without installing? Use `npx ai-burnrate-tool`)*
|
|
60
41
|
|
|
42
|
+
### π·οΈ Install a Specific Version
|
|
43
|
+
To install a specific release (e.g., `1.0.0`), specify the version tag:
|
|
61
44
|
```bash
|
|
62
|
-
|
|
63
|
-
npm install -g https://github.com/Cise07/ai-burnrate-tool/archive/refs/tags/vX.Y.Z.tar.gz
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```powershell
|
|
67
|
-
# Windows PowerShell
|
|
68
|
-
$env:BURNRATE_VERSION="vX.Y.Z"; irm https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/install.ps1 | iex
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# macOS / Linux
|
|
73
|
-
BURNRATE_VERSION=vX.Y.Z curl -fsSL https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/install.sh | bash
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## π οΈ Install from Local Clone (For Developers)
|
|
79
|
-
|
|
80
|
-
If you clone the repository locally, the installer script automatically detects `package.json`, installs dependencies, compiles both the React frontend (`dist/public`) and CLI (`dist/cli`), and registers the global `burnrate` binary:
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# 1. Clone the repository
|
|
84
|
-
git clone https://github.com/Cise07/ai-burnrate-tool.git
|
|
85
|
-
cd ai-burnrate-tool
|
|
86
|
-
|
|
87
|
-
# 2. Build and install globally
|
|
88
|
-
.\scripts\install.ps1 # Windows PowerShell
|
|
89
|
-
./scripts/install.sh # macOS / Linux
|
|
90
|
-
# Or via npm script:
|
|
91
|
-
npm run setup
|
|
45
|
+
npm install -g ai-burnrate-tool@X.Y.Z
|
|
92
46
|
```
|
|
93
47
|
|
|
94
48
|
---
|
|
@@ -103,9 +57,9 @@ Once installed, the **`burnrate`** (or **`ai-burnrate`**) command is available g
|
|
|
103
57
|
| `burnrate --cli` | π **Terminal Mode:** Syncs pricing, prints the full token & cost report in colorized ANSI tables in the terminal, and exits immediately. |
|
|
104
58
|
| `burnrate --no-open` | π **Headless Mode:** Starts the live server and file watcher without automatically opening the browser. |
|
|
105
59
|
| `burnrate -p, --port <number>` | π **Custom Port:** Starts the dashboard on a specific port (default: `4321`, automatically falling back to the next free port if busy). |
|
|
106
|
-
| `burnrate --update` | π **Self-Update:** Updates `ai-burnrate` to the latest
|
|
60
|
+
| `burnrate --update` | π **Self-Update:** Updates `ai-burnrate-tool` to the latest version from npm. |
|
|
107
61
|
| `burnrate --uninstall` | ποΈ **Self-Uninstall:** Completely removes the global `burnrate` package from your system. |
|
|
108
|
-
| `burnrate -V, --version` | π·οΈ Prints the installed version
|
|
62
|
+
| `burnrate -V, --version` | π·οΈ Prints the installed version. |
|
|
109
63
|
| `burnrate -h, --help` | βΉοΈ Displays all available CLI options. |
|
|
110
64
|
|
|
111
65
|
> π‘ **Clean Shutdown:** While running in live mode (`burnrate`), press `Ctrl+C` (`SIGINT`) to cleanly close all SSE streams, active HTTP sockets, and the `chokidar` file watcher.
|
|
@@ -127,16 +81,6 @@ burnrate --uninstall
|
|
|
127
81
|
npm uninstall -g ai-burnrate-tool
|
|
128
82
|
```
|
|
129
83
|
|
|
130
|
-
### 3οΈβ£ Via One-Liner Script
|
|
131
|
-
- **Windows (PowerShell):**
|
|
132
|
-
```powershell
|
|
133
|
-
irm https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/uninstall.ps1 | iex
|
|
134
|
-
```
|
|
135
|
-
- **macOS / Linux:**
|
|
136
|
-
```bash
|
|
137
|
-
curl -fsSL https://raw.githubusercontent.com/Cise07/ai-burnrate-tool/main/scripts/uninstall.sh | bash
|
|
138
|
-
```
|
|
139
|
-
|
|
140
84
|
---
|
|
141
85
|
|
|
142
86
|
## π° How Pricing & Historical Rate Versioning Work
|
package/dist/cli/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getPackageRoot, syncOfficialPricing } from '../core/pricing.js';
|
|
|
10
10
|
import { startLogWatcher } from '../core/watcher.js';
|
|
11
11
|
import { startServer } from '../server/index.js';
|
|
12
12
|
import { printCliReport } from './reporter.js';
|
|
13
|
-
const
|
|
13
|
+
const NPM_PACKAGE = 'ai-burnrate-tool';
|
|
14
14
|
function getPackageVersion() {
|
|
15
15
|
try {
|
|
16
16
|
const pkgPath = path.join(getPackageRoot(), 'package.json');
|
|
@@ -21,37 +21,13 @@ function getPackageVersion() {
|
|
|
21
21
|
return '1.0.0';
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
function resolveNpmUpdateSpec() {
|
|
25
25
|
const requested = process.env.BURNRATE_VERSION?.trim();
|
|
26
26
|
if (requested) {
|
|
27
|
-
const
|
|
28
|
-
return {
|
|
29
|
-
label: tag,
|
|
30
|
-
url: `https://github.com/${REPO_SLUG}/archive/refs/tags/${tag}.tar.gz`,
|
|
31
|
-
};
|
|
27
|
+
const version = requested.replace(/^v/, '');
|
|
28
|
+
return `${NPM_PACKAGE}@${version}`;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
const res = await fetch(`https://api.github.com/repos/${REPO_SLUG}/releases/latest`, {
|
|
35
|
-
headers: { 'User-Agent': 'ai-burnrate-cli' },
|
|
36
|
-
signal: AbortSignal.timeout(4000),
|
|
37
|
-
});
|
|
38
|
-
if (res.ok) {
|
|
39
|
-
const data = (await res.json());
|
|
40
|
-
if (data.tag_name) {
|
|
41
|
-
return {
|
|
42
|
-
label: data.tag_name,
|
|
43
|
-
url: `https://github.com/${REPO_SLUG}/archive/refs/tags/${data.tag_name}.tar.gz`,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// Fallback to main branch if no GitHub Release exists yet or offline
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
label: 'main',
|
|
53
|
-
url: `https://github.com/${REPO_SLUG}/archive/refs/heads/main.tar.gz`,
|
|
54
|
-
};
|
|
30
|
+
return `${NPM_PACKAGE}@latest`;
|
|
55
31
|
}
|
|
56
32
|
const program = new Command();
|
|
57
33
|
program
|
|
@@ -61,23 +37,23 @@ program
|
|
|
61
37
|
.option('--cli', 'Print the usage report in ANSI tables in the terminal and exit immediately', false)
|
|
62
38
|
.option('--no-open', 'Start the live server and file watcher without automatically opening the browser')
|
|
63
39
|
.option('-p, --port <number>', 'Specify a custom port for the dashboard server', '4321')
|
|
64
|
-
.option('--update', 'Update ai-burnrate to the latest
|
|
40
|
+
.option('--update', 'Update ai-burnrate-tool to the latest version from npm', false)
|
|
65
41
|
.option('--uninstall', 'Uninstall ai-burnrate globally from your system', false);
|
|
66
42
|
program.parse(process.argv);
|
|
67
43
|
const opts = program.opts();
|
|
68
44
|
async function main() {
|
|
69
45
|
if (opts.update) {
|
|
70
|
-
const
|
|
71
|
-
console.log(`\n ${pc.cyan('β')} Updating ${pc.bold(
|
|
46
|
+
const targetSpec = resolveNpmUpdateSpec();
|
|
47
|
+
console.log(`\n ${pc.cyan('β')} Updating ${pc.bold(targetSpec)} from npm...`);
|
|
72
48
|
try {
|
|
73
|
-
execSync(`npm install -g ${
|
|
49
|
+
execSync(`npm install -g ${targetSpec}`, {
|
|
74
50
|
stdio: 'inherit',
|
|
75
51
|
});
|
|
76
|
-
console.log(` ${pc.green('β')} ${pc.bold(
|
|
52
|
+
console.log(` ${pc.green('β')} ${pc.bold(targetSpec)} updated successfully!\n`);
|
|
77
53
|
process.exit(0);
|
|
78
54
|
}
|
|
79
55
|
catch {
|
|
80
|
-
console.error(` ${pc.red('β')} Failed to update automatically. Try running:\n ${pc.cyan(`npm install -g ${
|
|
56
|
+
console.error(` ${pc.red('β')} Failed to update automatically. Try running:\n ${pc.cyan(`npm install -g ${targetSpec}`)}\n`);
|
|
81
57
|
process.exit(1);
|
|
82
58
|
}
|
|
83
59
|
}
|