@loongphy/codex-auth 0.2.6 → 0.3.0-alpha.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.
Files changed (2) hide show
  1. package/README.md +78 -12
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -94,10 +94,13 @@ Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -Error
94
94
 
95
95
  | Command | Description |
96
96
  |---------|-------------|
97
- | `codex-auth list [--debug]` | List all accounts |
97
+ | `codex-auth list [--live] [--api\|--skip-api]` | List all accounts. `--live` keeps refreshing the terminal view; `--api` forces remote refresh, while `--skip-api` forbids remote API use for this command. |
98
98
  | `codex-auth login [--device-auth]` | Run `codex login` (optionally with `--device-auth`), then add the current account |
99
- | `codex-auth switch [<email>]` | Switch active account interactively or by partial match |
100
- | `codex-auth remove` | Remove accounts with interactive multi-select |
99
+ | `codex-auth switch [--live] [--auto] [--api\|--skip-api]` | Switch the active account interactively. Without `--live` it exits after one switch; with `--live` it stays open and keeps refreshing. `--auto` requires `--live` and auto-switches away from the current account when the live view shows it as exhausted or returns a non-200 usage API status. |
100
+ | `codex-auth switch <query>` | Switch the active account directly by row number, alias, or fuzzy match using stored local data only. |
101
+ | `codex-auth remove [--live] [--api\|--skip-api]` | Interactive remove. `--live` keeps the picker open after each deletion; `--api` forces remote refresh and `--skip-api` forbids remote API use for this command. |
102
+ | `codex-auth remove <query> [<query>...]` | Remove one or more accounts by row number, alias, email, account name, or `account_key` match using stored local data. |
103
+ | `codex-auth remove --all` | Remove all stored accounts. |
101
104
  | `codex-auth status` | Show auto-switch, service, and usage status |
102
105
 
103
106
  ### Import
@@ -126,35 +129,96 @@ Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -Error
126
129
 
127
130
  ```shell
128
131
  codex-auth list
129
- codex-auth list --debug
132
+ codex-auth list --live
133
+ codex-auth list --api # force usage/team-name API refresh, even if config api is disabled
134
+ codex-auth list --skip-api # forbid usage/team-name API refresh for this command
130
135
  ```
131
136
 
132
- ### Switch Account
137
+ `--live` keeps the list refreshing inside the terminal UI.
138
+ `--api` forces the foreground usage and team-name refresh path for this command only.
139
+ `--skip-api` forbids remote refresh for this command only. Usage can still refresh locally for the active account when local rollout data exists.
133
140
 
134
- Interactive: shows email, 5h, weekly, and last activity.
141
+ ### Switch Account
135
142
 
136
143
  ```shell
137
144
  codex-auth switch
145
+ codex-auth switch --live
146
+ codex-auth switch --live --auto
147
+ codex-auth switch --api
148
+ codex-auth switch --skip-api
138
149
  ```
139
150
 
140
- ![command switch](https://github.com/user-attachments/assets/48a86acf-2a6e-4206-a8c4-591989fdc0df)
151
+ `codex-auth switch`
152
+ Opens the interactive picker. It shows email, 5h, weekly, and last activity, then exits after one successful switch.
153
+
154
+ `codex-auth switch --live`
155
+ Keeps the picker open after Enter, keeps refreshing the terminal view, and updates the footer with the latest switch result.
156
+
157
+ `codex-auth switch --live --auto`
158
+ Keeps watching the current live display and auto-switches only when the active account reaches `0%` on 5h or weekly, or when the usage API returns a non-200 status for the active account.
159
+
160
+ `codex-auth switch --api`
161
+ Forces a foreground remote refresh before opening the picker.
141
162
 
142
- Non-interactive: fuzzy match by email or alias.
163
+ `codex-auth switch --skip-api`
164
+ Forbids remote API use for this command and relies on local-only usage refresh where available.
165
+
166
+ `codex-auth switch <query>`
167
+ Switches directly by displayed row number, alias, or fuzzy email/alias match using stored local data only. The row number follows the interactive `switch` list, and the same number from `codex-auth list` also works because both commands use the same ordering. `switch <query>` does not accept `--live`, `--auto`, `--api`, or `--skip-api`.
168
+
169
+ When `--live --auto` is active, auto-switch candidates still follow the live picker rules and skip accounts whose current 5h or weekly value is already `0%`.
170
+
171
+ ![command switch](https://github.com/user-attachments/assets/48a86acf-2a6e-4206-a8c4-591989fdc0df)
143
172
 
144
173
  ```shell
145
- codex-auth switch john # match any account containing "john"
146
- codex-auth switch john@gmail.com # match by full or partial email
147
- codex-auth switch work # match by alias set during import
174
+ codex-auth switch 02 # switch by displayed row number
175
+ codex-auth switch john # fuzzy match by email or alias
176
+ codex-auth switch work # match by alias set during import
148
177
  ```
149
178
 
150
- If the keyword matches multiple accounts, the command falls back to interactive selection. Press `q` to quit without switching.
179
+ If `<query>` matches multiple accounts, the command falls back to interactive selection. Press `q` to quit without switching.
151
180
 
152
181
  ### Remove Accounts
153
182
 
154
183
  ```shell
155
184
  codex-auth remove
185
+ codex-auth remove --live
186
+ codex-auth remove --api
187
+ codex-auth remove --skip-api
156
188
  ```
157
189
 
190
+ `codex-auth remove`
191
+ Opens the interactive remove picker. It stays local-only by default so deletion is not blocked by API refresh work.
192
+
193
+ `codex-auth remove --live`
194
+ Keeps the picker open after each deletion so you can continue cleaning up accounts in one session.
195
+
196
+ `codex-auth remove --api`
197
+ Attempts a best-effort foreground refresh for picker display. Successful rows show live API data when it is available; rows that cannot refresh may show live error overlays such as `403`, `TimedOut`, or `MissingAuth` instead.
198
+
199
+ `codex-auth remove --skip-api`
200
+ Keeps the picker local-only explicitly and forbids remote API use for this command.
201
+
202
+ `codex-auth remove <query> [<query>...]`
203
+ Removes one or more accounts by row number, alias, email, account name, or `account_key` match using stored local data only.
204
+
205
+ `codex-auth remove --all`
206
+ Removes all stored accounts.
207
+
208
+ Each selector supports the same query forms as `switch`: row number, alias, or fuzzy email/alias match.
209
+ The row number follows the interactive `switch` list, and the same number from `codex-auth list` also works because both commands use the same ordering.
210
+ You can pass multiple selectors in one command.
211
+ Selector-based `remove` and `remove --all` do not accept `--live`, `--api`, or `--skip-api`.
212
+
213
+ ```shell
214
+ codex-auth remove 01 03
215
+ codex-auth remove work personal
216
+ codex-auth remove 01 jane@example.com
217
+ codex-auth remove --all
218
+ ```
219
+
220
+ If any selector matches multiple accounts, `remove` asks for confirmation in interactive terminals before deleting.
221
+
158
222
  ### Login (Add Account)
159
223
 
160
224
  Add the currently logged-in Codex account:
@@ -240,6 +304,8 @@ When auto-switching is enabled, a long-running background watcher refreshes the
240
304
  - 5h remaining reaches `0`, or
241
305
  - weekly remaining reaches `0`
242
306
 
307
+ Auto-switch evaluates both 5h and weekly by default, without separate threshold configuration.
308
+ Candidates whose current 5h or weekly value is already `0` are skipped.
243
309
  When choosing the next account, `codex-auth` prefers a usable account whose remaining quota resets sooner, so a reset at `05:11` wins over `05:30`.
244
310
 
245
311
  The managed background worker is long-running on all supported platforms:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loongphy/codex-auth",
3
- "version": "0.2.6",
3
+ "version": "0.3.0-alpha.1",
4
4
  "type": "module",
5
5
  "description": "CLI for switching Codex accounts",
6
6
  "license": "MIT",
@@ -21,12 +21,12 @@
21
21
  "README.md"
22
22
  ],
23
23
  "optionalDependencies": {
24
- "@loongphy/codex-auth-linux-x64": "0.2.6",
25
- "@loongphy/codex-auth-linux-arm64": "0.2.6",
26
- "@loongphy/codex-auth-darwin-x64": "0.2.6",
27
- "@loongphy/codex-auth-darwin-arm64": "0.2.6",
28
- "@loongphy/codex-auth-win32-x64": "0.2.6",
29
- "@loongphy/codex-auth-win32-arm64": "0.2.6"
24
+ "@loongphy/codex-auth-linux-x64": "0.3.0-alpha.1",
25
+ "@loongphy/codex-auth-linux-arm64": "0.3.0-alpha.1",
26
+ "@loongphy/codex-auth-darwin-x64": "0.3.0-alpha.1",
27
+ "@loongphy/codex-auth-darwin-arm64": "0.3.0-alpha.1",
28
+ "@loongphy/codex-auth-win32-x64": "0.3.0-alpha.1",
29
+ "@loongphy/codex-auth-win32-arm64": "0.3.0-alpha.1"
30
30
  },
31
31
  "scripts": {
32
32
  "check:versions": "node scripts/npm/check-versions.mjs",