antigravity-usage 0.1.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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2732 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Antigravity Usage Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# antigravity-usage
|
|
2
|
+
|
|
3
|
+
CLI tool to check Antigravity model quota via Google Cloud Code API. Supports multiple Google accounts simultaneously.
|
|
4
|
+
|
|
5
|
+
Inspired by [ccusage](https://github.com/ryoppippi/ccusage).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g antigravity-usage
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Login with your first account
|
|
17
|
+
antigravity-usage login
|
|
18
|
+
|
|
19
|
+
# Add more accounts
|
|
20
|
+
antigravity-usage accounts add
|
|
21
|
+
|
|
22
|
+
# See quota for ALL accounts at once
|
|
23
|
+
antigravity-usage quota --all
|
|
24
|
+
|
|
25
|
+
# Switch active account
|
|
26
|
+
antigravity-usage accounts switch user@gmail.com
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `antigravity-usage accounts`
|
|
32
|
+
|
|
33
|
+
Manage multiple Google accounts.
|
|
34
|
+
|
|
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
|
+
```
|
|
43
|
+
|
|
44
|
+
### `antigravity-usage login`
|
|
45
|
+
|
|
46
|
+
Authenticate with Google (adds to your accounts list).
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
antigravity-usage login [options]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- `--no-browser`: Print URL instead of opening browser
|
|
53
|
+
- `-p, --port <port>`: Specify callback server port
|
|
54
|
+
|
|
55
|
+
### `antigravity-usage quota`
|
|
56
|
+
|
|
57
|
+
Fetch and display quota information (default command).
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
antigravity-usage quota [options]
|
|
61
|
+
```
|
|
62
|
+
|
|
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`
|
|
69
|
+
|
|
70
|
+
### `antigravity-usage status`
|
|
71
|
+
|
|
72
|
+
Show authentication and token status.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
antigravity-usage status # Status for active account
|
|
76
|
+
antigravity-usage status --all # Status for all accounts
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `antigravity-usage logout`
|
|
80
|
+
|
|
81
|
+
Remove stored credentials.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
antigravity-usage logout [email] # Logout specific account
|
|
85
|
+
antigravity-usage logout --all # Logout from all accounts
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
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.
|
|
94
|
+
|
|
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.
|
|
99
|
+
|
|
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.
|
|
105
|
+
|
|
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).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Configuration
|
|
114
|
+
|
|
115
|
+
### OAuth Credentials
|
|
116
|
+
The tool works out of the box with built-in credentials. To use your own:
|
|
117
|
+
```bash
|
|
118
|
+
export ANTIGRAVITY_OAUTH_CLIENT_ID="..."
|
|
119
|
+
export ANTIGRAVITY_OAUTH_CLIENT_SECRET="..."
|
|
120
|
+
```
|
|
121
|
+
|
|
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/`
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm run dev -- quota --all
|
|
132
|
+
npm test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
MIT
|
package/dist/index.d.ts
ADDED