agyuse 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.en.md +108 -0
- package/README.md +105 -2
- package/bin/agyuse.js +30 -0
- package/package.json +34 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SuperYang006
|
|
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.en.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# agyuse
|
|
2
|
+
|
|
3
|
+
[中文](README.md) · [Website](https://superyang006.github.io/agyuse/)
|
|
4
|
+
|
|
5
|
+
Switch the Antigravity CLI (`agy`) and the Antigravity desktop app between your Google accounts and see the remaining quota of each one in a single table.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ agyuse
|
|
9
|
+
# ACCOUNT GEMINI 5H GEMINI WEEK CLAUDE/GPT 5H CLAUDE/GPT WEEK UPDATED
|
|
10
|
+
1 per***@gmail.com 100% 100% 100% 100% 2h ago
|
|
11
|
+
* 2 wor***@gmail.com 47% 3h47m 65% 6d13h 100% 100% just now
|
|
12
|
+
Remaining quota, then the time until it fully resets.
|
|
13
|
+
|
|
14
|
+
$ agyuse 1
|
|
15
|
+
agy now uses per***@gmail.com (restart running agy sessions and the Antigravity app)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
agyuse is meant for switching between your own Google accounts, such as a personal and a work account. It is not affiliated with Google; follow the Google Antigravity terms of service. agyuse only switches when you run it and never rotates accounts automatically.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
**npm (recommended)**, requires Node.js 16 or later:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install -g agyuse
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or run it without installing: `npx agyuse`. npm downloads only the binary for your platform. Windows arm64 is not on npm yet; download it instead.
|
|
29
|
+
|
|
30
|
+
**Download**: get the archive for your platform from [GitHub Releases](https://github.com/SuperYang006/agyuse/releases) and put `agyuse` in a directory on your `PATH`.
|
|
31
|
+
|
|
32
|
+
**From source**, requires Go 1.22 or later:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
go install github.com/SuperYang006/agyuse@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Upgrade
|
|
39
|
+
|
|
40
|
+
agyuse does not update itself; upgrade it the way you installed it. `agyuse -v` shows the current version. Saved accounts live in `~/.agyuse` and are kept across upgrades.
|
|
41
|
+
|
|
42
|
+
| Installed with | Upgrade |
|
|
43
|
+
|---|---|
|
|
44
|
+
| npm | `npm install -g agyuse@latest` |
|
|
45
|
+
| npx | Run `npx agyuse@latest`; plain `npx agyuse` may keep using an older cached version |
|
|
46
|
+
| Download | Download the new version from GitHub Releases and replace the old `agyuse` |
|
|
47
|
+
| From source | Run `go install github.com/SuperYang006/agyuse@latest` again |
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
agyuse list saved accounts with their quota: the active one (marked *)
|
|
53
|
+
queried live, the others from cache
|
|
54
|
+
agyuse -r also re-query the inactive accounts one by one (slower)
|
|
55
|
+
agyuse <n|text|next> switch to account n, the account whose email contains text,
|
|
56
|
+
or the account after the active one
|
|
57
|
+
agyuse save save the account agy is currently logged in with
|
|
58
|
+
agyuse rm <n|text> forget a saved account
|
|
59
|
+
agyuse import ccswitch import the Antigravity accounts saved in CC Switch
|
|
60
|
+
agyuse lang [en|zh|auto] show or set the output language
|
|
61
|
+
agyuse -v print the version
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
To add accounts, log in with `agy` and run `agyuse save`; log out in `agy` (`/logout`), log in with another account, and run `agyuse save` again. From then on `agyuse <n>` switches without logging in again.
|
|
65
|
+
|
|
66
|
+
Output follows the system language; `agyuse lang zh` or `agyuse lang en` fixes it and `agyuse lang auto` follows the system again.
|
|
67
|
+
|
|
68
|
+
The CLI and the desktop app share one login, so a switch applies to both. After a switch, new `agy` sessions use the new account; restart running `agy` sessions and the desktop app.
|
|
69
|
+
|
|
70
|
+
## How quota is queried
|
|
71
|
+
|
|
72
|
+
Quota comes from agy's own `/usage` command, which spends no quota. agy can only report the logged-in account, so:
|
|
73
|
+
|
|
74
|
+
- The active account is queried live on every run, which waits for `agy` and depends on your network.
|
|
75
|
+
- Other accounts show their last queried values. An unused account's quota only recovers, and a bucket past its reset time is shown as 100%. The UPDATED column shows how old each value is.
|
|
76
|
+
- `agyuse -r` logs agy into each other account in turn and restores the original login afterwards, also on Ctrl-C. `agy` sessions or the desktop app started during the query may pick up the account being queried.
|
|
77
|
+
- `/usage` does not say whose quota it reports, so agyuse can only check after each query that the login still belongs to that account. Programs that query quota or switch the `agy` login on their own, such as CC Switch, may change the login during a query. When agyuse notices, the account shows "login changed by another program" and no quota is recorded; if the login is changed and changed back during the query, it goes unnoticed and the quota may be recorded for the wrong account. Pause their automatic quota queries before running `agyuse -r`.
|
|
78
|
+
|
|
79
|
+
## How it works and what is stored
|
|
80
|
+
|
|
81
|
+
agy and the desktop app keep their login in the system credential store (macOS Keychain, Windows Credential Manager, Linux Secret Service) under service `gemini`, user `antigravity`. Switching replaces that entry with the saved credential of the chosen account.
|
|
82
|
+
|
|
83
|
+
agyuse keeps its data in `~/.agyuse/`:
|
|
84
|
+
|
|
85
|
+
| File | Content |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `accounts.json` | Email and agy credential (including the refresh token) of each account, in **plain text**, readable only by you (mode 0600) |
|
|
88
|
+
| `quota.json` | Quota cache |
|
|
89
|
+
| `config.json` | Settings; currently only the language set with `agyuse lang` |
|
|
90
|
+
|
|
91
|
+
Anyone holding `accounts.json` can use these accounts; do not sync it to cloud storage or a dotfiles repository, or share it. agyuse makes no network requests itself; it only runs the local `agy`.
|
|
92
|
+
|
|
93
|
+
## Platform support
|
|
94
|
+
|
|
95
|
+
| Platform | Status |
|
|
96
|
+
|---|---|
|
|
97
|
+
| macOS | Verified |
|
|
98
|
+
| Windows | Implemented, not yet verified on a real machine; feedback welcome |
|
|
99
|
+
| Linux desktop with GNOME Keyring or KWallet | Implemented, not yet verified on a real machine; feedback welcome |
|
|
100
|
+
| Linux without D-Bus (servers, containers) | Not supported: agy then keeps its login in an undocumented encrypted file |
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
103
|
+
|
|
104
|
+
See [CONTRIBUTING.en.md](CONTRIBUTING.en.md) for building, testing and releasing.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
[MIT](LICENSE)
|
package/README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# agyuse
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.en.md) · [官网](https://superyang006.github.io/agyuse/)
|
|
4
|
+
|
|
5
|
+
在多个 Google 账号之间切换 Antigravity CLI(`agy`)和 Antigravity 桌面端的登录,并用一张表查看每个账号的剩余额度。
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
$ agyuse
|
|
9
|
+
# 账号 Gemini 5h Gemini 周 Claude/GPT 5h Claude/GPT 周 更新
|
|
10
|
+
1 per***@gmail.com 100% 100% 100% 100% 2 小时前
|
|
11
|
+
* 2 wor***@gmail.com 47% 3h47m 65% 6d13h 100% 100% 刚刚
|
|
12
|
+
百分比为剩余额度,后面是距离完全恢复的时间
|
|
13
|
+
|
|
14
|
+
$ agyuse 1
|
|
15
|
+
agy 已切换到 per***@gmail.com(正在运行的 agy 会话和 Antigravity 桌面端需要重启)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
适合在你自己的多个 Google 账号(比如个人账号和工作账号)之间切换。agyuse 与 Google 没有任何关联,请遵守 Google Antigravity 的服务条款。agyuse 只在你执行命令时切换账号,不会自动轮换账号。
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
**npm(推荐)**,需要 Node.js 16 或更高版本:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install -g agyuse
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
也可以不安装,直接运行 `npx agyuse`。npm 只会下载当前平台的可执行文件。Windows arm64 暂时还不能通过 npm 安装,请直接下载。
|
|
29
|
+
|
|
30
|
+
**直接下载**:从 [GitHub Releases](https://github.com/SuperYang006/agyuse/releases) 下载对应平台的压缩包,解压后把 `agyuse` 放到 `PATH` 中的目录。
|
|
31
|
+
|
|
32
|
+
**从源码安装**,需要 Go 1.22 或更高版本:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
go install github.com/SuperYang006/agyuse@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 升级
|
|
39
|
+
|
|
40
|
+
agyuse 不会自动更新,请用安装时的方式升级,`agyuse -v` 可以查看当前版本。已保存的账号在 `~/.agyuse` 中,升级不受影响。
|
|
41
|
+
|
|
42
|
+
| 安装方式 | 升级方法 |
|
|
43
|
+
|---|---|
|
|
44
|
+
| npm | `npm install -g agyuse@latest` |
|
|
45
|
+
| npx | 运行 `npx agyuse@latest`;只写 `npx agyuse` 可能继续使用缓存中的旧版本 |
|
|
46
|
+
| 直接下载 | 从 GitHub Releases 下载新版本,覆盖原来的 `agyuse` |
|
|
47
|
+
| 从源码安装 | 再次运行 `go install github.com/SuperYang006/agyuse@latest` |
|
|
48
|
+
|
|
49
|
+
## 使用
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
agyuse 列出已保存的账号及额度:当前账号(标 *)实时查询,其他账号显示缓存
|
|
53
|
+
agyuse -r 同时逐个重新查询其他账号,账号越多越慢
|
|
54
|
+
agyuse <n|text|next> 切换到第 n 个账号、邮箱包含 text 的账号,或下一个账号
|
|
55
|
+
agyuse save 保存 agy 当前登录的账号
|
|
56
|
+
agyuse rm <n|text> 删除一个已保存的账号
|
|
57
|
+
agyuse import ccswitch 导入 CC Switch 中保存的 Antigravity 账号
|
|
58
|
+
agyuse lang [en|zh|auto] 查看或设置输出语言
|
|
59
|
+
agyuse -v 显示版本
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
添加账号:在 `agy` 里登录一个账号,运行 `agyuse save`;退出 `agy` 中的登录(`/logout`),用另一个账号登录,再运行 `agyuse save`。之后用 `agyuse <n>` 即可直接切换,无需重新登录。
|
|
63
|
+
|
|
64
|
+
输出语言默认跟随系统,运行 `agyuse lang zh` 或 `agyuse lang en` 固定语言,`agyuse lang auto` 恢复跟随系统。
|
|
65
|
+
|
|
66
|
+
CLI 和桌面端共用同一个登录,切换对两者同时生效。切换后,新启动的 `agy` 会话使用新账号;已经在运行的 `agy` 会话和桌面端需要重启。
|
|
67
|
+
|
|
68
|
+
## 额度如何查询
|
|
69
|
+
|
|
70
|
+
额度来自 `agy` 自带的 `/usage` 命令,查询本身不消耗额度。`agy` 只能查询当前登录账号的额度,因此:
|
|
71
|
+
|
|
72
|
+
- 当前账号每次都会实时查询,需要等待 `agy` 返回结果,耗时取决于网络。
|
|
73
|
+
- 其他账号使用上次查询的缓存。未使用的账号额度只会恢复、不会减少;已经过了重置时间的额度显示为 100%。“更新”列显示缓存的新旧程度。
|
|
74
|
+
- `agyuse -r` 会依次临时登录每个其他账号查询,完成后恢复原登录(按 Ctrl-C 中断时也会恢复)。查询期间新启动的 `agy` 会话或桌面端可能会登录到正在查询的账号上。
|
|
75
|
+
- `/usage` 的结果不包含账号信息,agyuse 只能在每次查询后检查登录是否还是这个账号。CC Switch 等会定时查询额度或切换 `agy` 登录的程序,可能在查询期间改动登录:能检测到的,该账号显示“登录被其他程序改动”,不记录额度;若对方在查询期间改动后又改回,则无法察觉,额度可能记到错误的账号上。运行 `agyuse -r` 前,请先暂停这类程序的自动查询。
|
|
76
|
+
|
|
77
|
+
## 工作原理与数据存储
|
|
78
|
+
|
|
79
|
+
`agy` 和桌面端将登录凭据保存在系统凭据存储中(macOS 钥匙串、Windows 凭据管理器、Linux Secret Service),条目为 service `gemini`、user `antigravity`。agyuse 切换账号时,用已保存账号的凭据替换这一条目。
|
|
80
|
+
|
|
81
|
+
agyuse 的数据保存在 `~/.agyuse/`:
|
|
82
|
+
|
|
83
|
+
| 文件 | 内容 |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `accounts.json` | 各账号的邮箱和 `agy` 凭据(含刷新令牌),**明文**存储,仅当前用户可读(权限 0600) |
|
|
86
|
+
| `quota.json` | 额度缓存 |
|
|
87
|
+
| `config.json` | 设置,目前只有 `agyuse lang` 设置的语言 |
|
|
88
|
+
|
|
89
|
+
拿到 `accounts.json` 就等于可以使用这些账号,请不要把它同步到网盘、dotfiles 仓库或分享给他人。agyuse 自身不发起任何网络请求,只调用本机的 `agy`。
|
|
90
|
+
|
|
91
|
+
## 平台支持
|
|
92
|
+
|
|
93
|
+
| 平台 | 状态 |
|
|
94
|
+
|---|---|
|
|
95
|
+
| macOS | 已验证 |
|
|
96
|
+
| Windows | 已实现,尚未在真机验证,欢迎反馈 |
|
|
97
|
+
| Linux(桌面,有 GNOME Keyring 或 KWallet) | 已实现,尚未在真机验证,欢迎反馈 |
|
|
98
|
+
| Linux(无 D-Bus 的服务器或容器) | 不支持:此时 `agy` 把登录保存在格式未公开的加密文件中 |
|
|
99
|
+
|
|
100
|
+
## 参与开发
|
|
101
|
+
|
|
102
|
+
编译、测试和发布方法见 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
103
|
+
|
|
104
|
+
## 许可证
|
|
105
|
+
|
|
106
|
+
[MIT](LICENSE)
|
package/bin/agyuse.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Runs the agyuse binary from the platform package npm installed alongside this one.
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
const platformPackage = `agyuse-${process.platform}-${process.arch}`;
|
|
8
|
+
const exe = process.platform === "win32" ? "agyuse.exe" : "agyuse";
|
|
9
|
+
|
|
10
|
+
let binary;
|
|
11
|
+
try {
|
|
12
|
+
binary = require.resolve(`${platformPackage}/bin/${exe}`);
|
|
13
|
+
} catch {
|
|
14
|
+
console.error(
|
|
15
|
+
`agyuse: ${platformPackage} is not installed. If you installed with --omit=optional or --no-optional, ` +
|
|
16
|
+
"reinstall without it; otherwise npm has no package for this platform yet, so download agyuse from " +
|
|
17
|
+
"https://github.com/SuperYang006/agyuse/releases"
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
23
|
+
if (result.error) {
|
|
24
|
+
console.error(`agyuse: ${result.error.message}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
if (result.signal) {
|
|
28
|
+
process.kill(process.pid, result.signal);
|
|
29
|
+
}
|
|
30
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agyuse",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Switch Antigravity (agy CLI and desktop app) accounts and see their quota",
|
|
5
|
+
"homepage": "https://superyang006.github.io/agyuse/",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/SuperYang006/agyuse.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"antigravity",
|
|
13
|
+
"agy",
|
|
14
|
+
"account",
|
|
15
|
+
"switch",
|
|
16
|
+
"quota",
|
|
17
|
+
"cli"
|
|
18
|
+
],
|
|
19
|
+
"bin": {
|
|
20
|
+
"agyuse": "bin/agyuse.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"bin/",
|
|
24
|
+
"README.en.md"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=16"
|
|
28
|
+
},
|
|
29
|
+
"optionalDependencies": {
|
|
30
|
+
"agyuse-darwin-arm64": "0.1.1",
|
|
31
|
+
"agyuse-darwin-x64": "0.1.1",
|
|
32
|
+
"agyuse-linux-arm64": "0.1.1",
|
|
33
|
+
"agyuse-linux-x64": "0.1.1",
|
|
34
|
+
"agyuse-win32-x64": "0.1.1"
|
|
35
|
+
}
|
|
36
|
+
}
|