antigravity-usage 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -1,132 +1,204 @@
1
- # antigravity-usage
1
+ <div align="center">
2
+ <img src="images/icon.png" alt="antigravity-usage logo" width="150" height="150">
3
+ <h1>antigravity-usage</h1>
4
+ </div>
2
5
 
3
- CLI tool to check Antigravity model quota via Google Cloud Code API. Supports multiple Google accounts simultaneously.
6
+ <p align="center">
7
+ <a href="https://npmjs.com/package/antigravity-usage"><img src="https://img.shields.io/npm/v/antigravity-usage?color=yellow" alt="npm version" /></a>
8
+ <a href="https://packagephobia.com/result?p=antigravity-usage"><img src="https://packagephobia.com/badge?p=antigravity-usage" alt="install size" /></a>
9
+ <a href="https://www.npmjs.com/package/antigravity-usage"><img src="https://img.shields.io/npm/dt/antigravity-usage" alt="NPM Downloads" /></a>
10
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
11
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js Version" /></a>
12
+ </p>
4
13
 
5
- Inspired by [ccusage](https://github.com/ryoppippi/ccusage).
14
+ <p align="center">
15
+ A fast, lightweight, and powerful CLI tool to track your Antigravity model quota and usage. Works offline with your IDE or online with multiple Google accounts.
16
+ </p>
6
17
 
7
- ## Installation
18
+ <p align="center">
19
+ <em>Inspired by <a href="https://github.com/ryoppippi/ccusage">ccusage</a></em>
20
+ </p>
21
+
22
+ <div align="center">
23
+ <img src="images/banner.png" alt="Antigravity Usage Screenshot">
24
+ </div>
25
+
26
+
27
+ ## Quick Start (No Login Required) 🚀
28
+
29
+ If you have Antigravity running in your IDE (VSCode, JetBrains, etc.), you can check your quota immediately **without logging in**.
8
30
 
9
31
  ```bash
32
+ # Install globally
10
33
  npm install -g antigravity-usage
34
+
35
+ # Check quota immediately (uses your IDE's connection)
36
+ antigravity-usage
11
37
  ```
12
38
 
13
- ## Quick Start
39
+ That's it! The tool automatically connects to your local Antigravity server to fetch the exact same data your IDE sees.
14
40
 
41
+ ---
42
+
43
+ ## Power User Guide ⚡️
44
+
45
+ Want to check quota for **multiple accounts** or when your IDE is closed?
46
+
47
+ ### 1. Login with Google
15
48
  ```bash
16
- # Login with your first account
17
49
  antigravity-usage login
50
+ ```
18
51
 
19
- # Add more accounts
52
+ ### 2. Add more accounts
53
+ ```bash
20
54
  antigravity-usage accounts add
55
+ ```
21
56
 
22
- # See quota for ALL accounts at once
57
+ ### 3. Check everything at once
58
+ ```bash
23
59
  antigravity-usage quota --all
24
-
25
- # Switch active account
26
- antigravity-usage accounts switch user@gmail.com
27
60
  ```
28
61
 
29
- ## Commands
62
+ ---
30
63
 
31
- ### `antigravity-usage accounts`
64
+ ## How It Works 🛠️
32
65
 
33
- Manage multiple Google accounts.
66
+ Antigravity Usage employs a smart "Dual-Fetch" strategy to ensure you always get data:
34
67
 
35
- ```bash
36
- antigravity-usage accounts list # List all accounts & status
37
- antigravity-usage accounts add # Add a new account (OAuth)
38
- antigravity-usage accounts switch <email> # Set the active account
39
- antigravity-usage accounts remove <email> # Remove an account & its data
40
- antigravity-usage accounts current # Show active account info
41
- antigravity-usage accounts refresh --all # Refresh tokens for all accounts
42
- ```
68
+ 1. **Local Mode (Priority)**: First, it tries to connect to the Antigravity Language Server running inside your IDE.
69
+ * **Pros**: Fast, works offline, no extra login required.
70
+ * **Cons**: IDE must be open.
71
+ 2. **Cloud Mode (Fallback)**: If Local Mode fails (or if managing multiple accounts), it uses the Google Cloud Code API.
72
+ * **Pros**: Works anywhere, supports multiple accounts.
73
+ * **Cons**: Requires one-time login.
43
74
 
44
- ### `antigravity-usage login`
75
+ By default, `antigravity-usage` runs in **Auto Mode**, seamlessly switching between these methods.
45
76
 
46
- Authenticate with Google (adds to your accounts list).
77
+ ---
47
78
 
48
- ```bash
49
- antigravity-usage login [options]
50
- ```
79
+ ## Features
51
80
 
52
- - `--no-browser`: Print URL instead of opening browser
53
- - `-p, --port <port>`: Specify callback server port
81
+ ### 🔐 Multi-Account Management
82
+ Seamlessly juggle multiple Google accounts (e.g., Personal vs Work).
83
+ - **Parallel Fetching**: optional `--all` flag fetches data for all accounts simultaneously.
84
+ - **Privacy Focused**: Tokens are stored locally on your machine, never sent to third-party servers.
54
85
 
55
- ### `antigravity-usage quota`
86
+ ### 🔌 Offline Capabilities
87
+ Designed for plane rides and spotty wifi.
88
+ - **Direct IDE Access**: Reads directly from the local server loopback.
89
+ - **Smart Fallbacks**: If the internet cuts out, it defaults to the last known state from your local IDE.
56
90
 
57
- Fetch and display quota information (default command).
91
+ ### ⚡️ Smart Caching
92
+ To keep the CLI snappy and avoid hitting API rate limits:
93
+ - Quota data is cached for **5 minutes**.
94
+ - Use the `--refresh` flag to force a new fetch:
95
+ ```bash
96
+ antigravity-usage quota --refresh
97
+ ```
58
98
 
59
- ```bash
60
- antigravity-usage quota [options]
61
- ```
99
+ ### 📱 Responsive UI
100
+ Tables automatically adapt to your terminal size, switching between "Compact" and "Spacious" views to show you the most relevant data without wrapping.
62
101
 
63
- Options:
64
- - `--all`: Fetch data for **all** accounts in parallel
65
- - `-a, --account <email>`: Fetch data for a specific account
66
- - `--refresh`: Force fresh data (ignore local cache)
67
- - `--json`: Output as JSON
68
- - `-m, --method <method>`: `auto` (default), `local`, or `google`
102
+ ---
69
103
 
70
- ### `antigravity-usage status`
104
+ ## Command Reference
71
105
 
72
- Show authentication and token status.
106
+ ### `antigravity-usage` (Default)
107
+ Alias for `quota`. Fetches and displays usage data.
73
108
 
74
109
  ```bash
75
- antigravity-usage status # Status for active account
76
- antigravity-usage status --all # Status for all accounts
110
+ antigravity-usage # Auto-detect (Local -> Cloud)
111
+ antigravity-usage --all # Fetch ALL accounts
112
+ antigravity-usage --method local # Force local IDE connection
113
+ antigravity-usage --method google # Force google IDE connection
114
+ antigravity-usage --json # Output JSON for scripts
77
115
  ```
78
116
 
79
- ### `antigravity-usage logout`
117
+ ### `antigravity-usage accounts`
118
+ Manage your roster of Google accounts.
80
119
 
81
- Remove stored credentials.
120
+ ```bash
121
+ antigravity-usage accounts list # Show all accounts & status
122
+ antigravity-usage accounts add # Login a new account
123
+ antigravity-usage accounts switch <email> # Set active account
124
+ antigravity-usage accounts remove <email> # Logout & delete data
125
+ ```
126
+
127
+ ### `antigravity-usage doctor`
128
+ Troubleshoot issues with your setup. Checks env vars, auth status, and local server connectivity.
129
+
130
+ ### `antigravity-usage status`
131
+ Quickly check if your auth tokens are valid or expired.
132
+
133
+ ### `antigravity-usage wakeup` 🚀
134
+ **Never waste quota again.** Automatically wake up your AI models at strategic times to maximize your daily limits.
82
135
 
83
136
  ```bash
84
- antigravity-usage logout [email] # Logout specific account
85
- antigravity-usage logout --all # Logout from all accounts
137
+ antigravity-usage wakeup config # Interactive setup (takes 30 seconds)
138
+ antigravity-usage wakeup install # Install to native system cron
139
+ antigravity-usage wakeup status # Check configuration & next run
140
+ antigravity-usage wakeup test # Test trigger manually
141
+ antigravity-usage wakeup history # View trigger history
86
142
  ```
87
143
 
88
- ## Features
144
+ **Why This Matters:**
145
+ Your Antigravity quota resets every ~5 hours, but if you don't use it, you lose it. The wakeup feature ensures you **automatically trigger** both Claude and Gemini models to keep your quota flowing.
89
146
 
90
- ### Smart Caching
91
- To keep things snappy when managing many accounts, the tool caches quota data for **5 minutes**.
92
- - Use `--refresh` to bypass the cache.
93
- - The cache is stored per-account.
147
+ #### 🎯 Intelligent Model Selection
148
+ Zero configuration needed. Automatically wakes up:
149
+ - **`claude-sonnet-4-5`** Triggers the entire Claude family
150
+ - **`gemini-3-flash`** Triggers the entire Gemini family
94
151
 
95
- ### Offline Capabilities 🔌
96
- Antigravity Usage is designed to work seamlessly offline:
97
- 1. **Local Method**: Reads directly from your IDE's language server (no internet required).
98
- 2. **Caching**: If you're completely offline, you can still view the last known quota for all your accounts.
152
+ Both models combined ensure comprehensive coverage and optimal quota utilization across all available AI models.
99
153
 
100
- ### Responsive UI 📱
101
- Tables automatically adapt to your terminal size:
102
- - **Compact View**: For smaller screens or side-by-side terminals.
103
- - **Spacious View**: Optimizes layout for wide terminals.
104
- - **Auto-sizing**: Gracefully handles very small widths.
154
+ #### ⚡️ Two Powerful Trigger Modes
105
155
 
106
- ### Fetch Methods
107
- - **auto (default)**: Tries local Antigravity server first (offline), then falls back to Google API (online).
108
- - **local**: Only talks to your IDE's Antigravity server (**Offline**, no login needed).
109
- - **google**: Only talks to Google Cloud APIs (Online only).
156
+ **1. Schedule-Based** (Native Cron Integration)
157
+ Runs locally on your machine with zero dependencies:
158
+ - **Interval Mode**: Every N hours (e.g., every 6 hours)
159
+ - **Daily Mode**: At specific times (e.g., 9 AM, 5 PM)
160
+ - **Custom Mode**: Advanced cron expressions for power users
110
161
 
111
- ---
162
+ ```bash
163
+ antigravity-usage wakeup install
164
+ # ✅ Installs to your system's native crontab
165
+ # ✅ Runs even when terminal/antigravity is closed
166
+ # ✅ Persists across reboots
167
+ ```
112
168
 
113
- ## Configuration
169
+ **2. Smart Quota-Reset Detection** (Zero-Waste Mode)
170
+ The most intelligent trigger mode. Automatically detects when:
171
+ - Quota is at **100%** (unused)
172
+ - Reset time is **~5 hours away** (just reset)
173
+ - No cooldown conflicts
174
+
175
+ When triggered, it wakes up **ALL** your accounts simultaneously, ensuring none of your quota goes to waste.
176
+
177
+ #### 🛡️ Built-in Safety Features
178
+ - **Cooldown Protection**: Prevents duplicate triggers (1-hour default)
179
+ - **Multi-Account Support**: Trigger for specific accounts or all at once
180
+ - **Detailed History**: Track every trigger with timestamps and results
181
+ - **Graceful Failures**: Automatic retry logic with exponential backoff
182
+ - **Token Efficiency**: Minimal output tokens (just 1 token per request)
114
183
 
115
- ### OAuth Credentials
116
- The tool works out of the box with built-in credentials. To use your own:
184
+ #### 📊 Real-Time Monitoring
117
185
  ```bash
118
- export ANTIGRAVITY_OAUTH_CLIENT_ID="..."
119
- export ANTIGRAVITY_OAUTH_CLIENT_SECRET="..."
186
+ antigravity-usage wakeup status
120
187
  ```
188
+ Shows:
189
+ - ✅ Enabled/disabled status
190
+ - 📅 Next scheduled run time
191
+ - 🎯 Selected models and accounts
192
+ - 📝 Last trigger result
193
+ - ⚙️ Cron installation status
121
194
 
122
- ### Token Storage
123
- Data is stored in your system's config directory:
124
- - **macOS**: `~/Library/Application Support/antigravity-usage/accounts/`
125
- - **Linux**: `~/.config/antigravity-usage/accounts/`
126
- - **Windows**: `%APPDATA%/antigravity-usage/accounts/`
195
+ ## Configuration
196
+ Data is stored in your system's standard config location:
197
+ - **macOS**: `~/Library/Application Support/antigravity-usage/`
198
+ - **Linux**: `~/.config/antigravity-usage/`
199
+ - **Windows**: `%APPDATA%/antigravity-usage/`
127
200
 
128
201
  ## Development
129
-
130
202
  ```bash
131
203
  npm run dev -- quota --all
132
204
  npm test