@wangxt0223/codex-switcher 0.6.4 → 0.6.5
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/CHANGELOG.md +6 -0
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/plugins/codex-switcher/README.en.md +1 -2
- package/plugins/codex-switcher/README.md +1 -2
- package/plugins/codex-switcher/scripts/codex-switcher +8 -11
- package/plugins/codex-switcher/scripts/test-switcher.sh +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.5 - 2026-04-12
|
|
4
|
+
|
|
5
|
+
- Removed `LAST ACTIVITY` from `list` default output columns.
|
|
6
|
+
- `list` now prints: `ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE / SOURCE`.
|
|
7
|
+
- Updated command help text, Chinese/English README docs, and smoke-test assertions for the new column layout.
|
|
8
|
+
|
|
3
9
|
## 0.6.4 - 2026-04-12
|
|
4
10
|
|
|
5
11
|
- Updated `list` output columns to include `HOME` and a dedicated `SOURCE` column (`api`/`local`).
|
package/README.en.md
CHANGED
|
@@ -81,7 +81,7 @@ Commands below use `codex-sw` (all are equivalent under `codex-switcher`):
|
|
|
81
81
|
| Account | `codex-sw account logout [account] [--env <env>] [--target cli\|app\|both]` | Logout account |
|
|
82
82
|
| Account | `codex-sw account current [cli\|app]` | Show current env/account pointer |
|
|
83
83
|
| Usage proxy | `codex-sw proxy [<host:port>\|off\|test]` | Configure/test usage API proxy (only affects `list`) |
|
|
84
|
-
| Query/Run | `codex-sw list` | Show `ENV/HOME/ACCOUNT/EMAIL/PLAN/5H/WEEKLY/
|
|
84
|
+
| Query/Run | `codex-sw list` | Show `ENV/HOME/ACCOUNT/EMAIL/PLAN/5H/WEEKLY/SOURCE` |
|
|
85
85
|
| Query/Run | `codex-sw status` | Show login status for current CLI/App pointers |
|
|
86
86
|
| Query/Run | `codex-sw current [cli\|app]` | Show current env/account |
|
|
87
87
|
| Query/Run | `codex-sw exec -- <codex args...>` | Run `codex` under current CLI env/account |
|
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ codex-switcher account use corp --env project-a
|
|
|
78
78
|
| 账号管理 | `codex-sw account logout [account] [--env <env>] [--target cli\|app\|both]` | 注销账号(删除对应 auth) |
|
|
79
79
|
| 账号管理 | `codex-sw account current [cli\|app]` | 查看当前 env/account 指针 |
|
|
80
80
|
| 用量代理 | `codex-sw proxy [<host:port>\|off\|test]` | 设置/关闭/测试“用量 API”代理(仅影响 `list`) |
|
|
81
|
-
| 查询执行 | `codex-sw list` | 展示 `ENV/HOME/ACCOUNT/EMAIL/PLAN/5H/WEEKLY/
|
|
81
|
+
| 查询执行 | `codex-sw list` | 展示 `ENV/HOME/ACCOUNT/EMAIL/PLAN/5H/WEEKLY/SOURCE` |
|
|
82
82
|
| 查询执行 | `codex-sw status` | 检查 CLI/App 当前登录状态 |
|
|
83
83
|
| 查询执行 | `codex-sw current [cli\|app]` | 查看当前 env/account |
|
|
84
84
|
| 查询执行 | `codex-sw exec -- <codex args...>` | 在当前 CLI env/account 下执行 `codex` |
|
package/package.json
CHANGED
|
@@ -74,14 +74,13 @@ codex-switcher account use corp --env project-a
|
|
|
74
74
|
|
|
75
75
|
`codex-switcher list` prints:
|
|
76
76
|
|
|
77
|
-
`ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE /
|
|
77
|
+
`ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE / SOURCE`
|
|
78
78
|
|
|
79
79
|
Usage data strategy:
|
|
80
80
|
|
|
81
81
|
- API first (`chatgpt.com/backend-api/wham/usage`)
|
|
82
82
|
- Auto fallback to local `sessions/*.jsonl` on API failure
|
|
83
83
|
- `5H USAGE` / `WEEKLY USAGE` reset time is unified to `MM-DD HH:MM` (example: `89% (04-19 11:45)`)
|
|
84
|
-
- `LAST ACTIVITY` uses absolute `MM-DD HH:MM` format
|
|
85
84
|
- `SOURCE` is shown as a dedicated column (`api` or `local`)
|
|
86
85
|
- You can configure a dedicated proxy for this usage API via `codex-switcher proxy 127.0.0.1:7899` (only affects `list`)
|
|
87
86
|
- If no manual proxy is configured, env/system proxy settings are auto-detected for usage API requests
|
|
@@ -74,14 +74,13 @@ codex-switcher account use corp --env project-a
|
|
|
74
74
|
|
|
75
75
|
`codex-switcher list` 默认输出:
|
|
76
76
|
|
|
77
|
-
`ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE /
|
|
77
|
+
`ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE / SOURCE`
|
|
78
78
|
|
|
79
79
|
其中用量数据策略为:
|
|
80
80
|
|
|
81
81
|
- 默认优先 API(`chatgpt.com/backend-api/wham/usage`)
|
|
82
82
|
- API 失败自动回退本地 `sessions/*.jsonl`
|
|
83
83
|
- `5H USAGE` / `WEEKLY USAGE` 的重置时间统一为 `MM-DD HH:MM`(例如 `89% (04-19 11:45)`)
|
|
84
|
-
- `LAST ACTIVITY` 使用绝对时间 `MM-DD HH:MM`
|
|
85
84
|
- `SOURCE` 独立显示 `api` 或 `local`
|
|
86
85
|
- 可通过 `codex-switcher proxy 127.0.0.1:7899` 为该用量 API 单独配置代理(仅影响 `list`)
|
|
87
86
|
- 未手动设置时会自动检测环境变量/系统代理并用于用量 API 请求
|
|
@@ -87,7 +87,7 @@ Notes:
|
|
|
87
87
|
- Same-env account switch only swaps auth.json and does not sync shared data.
|
|
88
88
|
- `proxy` only affects usage API calls used by `list`.
|
|
89
89
|
- If manual proxy is not set, usage API proxy is auto-detected from env/system proxy settings.
|
|
90
|
-
- `list` prints: ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE /
|
|
90
|
+
- `list` prints: ENV / HOME / ACCOUNT / EMAIL / PLAN / 5H USAGE / WEEKLY USAGE / SOURCE.
|
|
91
91
|
- Usage metrics are API-first and automatically fallback to local sessions; source is shown as (api|local).
|
|
92
92
|
USAGE
|
|
93
93
|
}
|
|
@@ -1147,7 +1147,8 @@ PY
|
|
|
1147
1147
|
cmd_list() {
|
|
1148
1148
|
local cli_env app_env cli_account app_account
|
|
1149
1149
|
local env account marks auth_file home home_display metrics
|
|
1150
|
-
local email plan usage_5h usage_weekly
|
|
1150
|
+
local email plan usage_5h usage_weekly source
|
|
1151
|
+
local _last_activity=""
|
|
1151
1152
|
local usage_proxy="" usage_info=""
|
|
1152
1153
|
|
|
1153
1154
|
cli_env="$(read_current_env cli || true)"
|
|
@@ -1159,7 +1160,7 @@ cmd_list() {
|
|
|
1159
1160
|
IFS=$'\t' read -r _ usage_proxy <<< "$usage_info"
|
|
1160
1161
|
fi
|
|
1161
1162
|
|
|
1162
|
-
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s
|
|
1163
|
+
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s %s\n' "ENV" "HOME" "ACCOUNT" "EMAIL" "PLAN" "5H USAGE" "WEEKLY USAGE" "SOURCE"
|
|
1163
1164
|
while IFS= read -r env; do
|
|
1164
1165
|
home="$(env_home_path "$env")"
|
|
1165
1166
|
home_display="$(display_path_for_output "$home")"
|
|
@@ -1171,7 +1172,6 @@ cmd_list() {
|
|
|
1171
1172
|
plan=""
|
|
1172
1173
|
usage_5h=""
|
|
1173
1174
|
usage_weekly=""
|
|
1174
|
-
last_activity=""
|
|
1175
1175
|
source=""
|
|
1176
1176
|
marks=""
|
|
1177
1177
|
[[ "$env" == "$cli_env" && "$account" == "$cli_account" ]] && marks="${marks} [cli-current]"
|
|
@@ -1181,17 +1181,16 @@ cmd_list() {
|
|
|
1181
1181
|
|
|
1182
1182
|
metrics="$(collect_profile_metrics_tsv "$account" "$auth_file" "$home" "$usage_proxy" || true)"
|
|
1183
1183
|
if [[ -n "$metrics" ]]; then
|
|
1184
|
-
IFS=$'\t' read -r email plan usage_5h usage_weekly
|
|
1184
|
+
IFS=$'\t' read -r email plan usage_5h usage_weekly _last_activity source <<< "$metrics"
|
|
1185
1185
|
fi
|
|
1186
1186
|
email="${email:-($account)-}"
|
|
1187
1187
|
plan="${plan:-unknown}"
|
|
1188
1188
|
usage_5h="${usage_5h:--}"
|
|
1189
1189
|
usage_weekly="${usage_weekly:--}"
|
|
1190
|
-
last_activity="${last_activity:--}"
|
|
1191
1190
|
source="${source:-local}"
|
|
1192
1191
|
[[ "$source" == "api" || "$source" == "local" ]] || source="local"
|
|
1193
1192
|
|
|
1194
|
-
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s
|
|
1193
|
+
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s %s\n' "$env" "$home_display" "$account$marks" "$email" "$plan" "$usage_5h" "$usage_weekly" "$source"
|
|
1195
1194
|
done < <(list_accounts_for_env "$env")
|
|
1196
1195
|
|
|
1197
1196
|
if [[ "$found" -eq 0 ]]; then
|
|
@@ -1199,20 +1198,18 @@ cmd_list() {
|
|
|
1199
1198
|
plan=""
|
|
1200
1199
|
usage_5h=""
|
|
1201
1200
|
usage_weekly=""
|
|
1202
|
-
last_activity=""
|
|
1203
1201
|
source=""
|
|
1204
1202
|
metrics="$(collect_profile_metrics_tsv "-" "$home/auth.json" "$home" "$usage_proxy" || true)"
|
|
1205
1203
|
if [[ -n "$metrics" ]]; then
|
|
1206
|
-
IFS=$'\t' read -r email plan usage_5h usage_weekly
|
|
1204
|
+
IFS=$'\t' read -r email plan usage_5h usage_weekly _last_activity source <<< "$metrics"
|
|
1207
1205
|
fi
|
|
1208
1206
|
email="${email:--}"
|
|
1209
1207
|
plan="${plan:-unknown}"
|
|
1210
1208
|
usage_5h="${usage_5h:--}"
|
|
1211
1209
|
usage_weekly="${usage_weekly:--}"
|
|
1212
|
-
last_activity="${last_activity:--}"
|
|
1213
1210
|
source="${source:-local}"
|
|
1214
1211
|
[[ "$source" == "api" || "$source" == "local" ]] || source="local"
|
|
1215
|
-
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s
|
|
1212
|
+
printf '%-12s %-28s %-30s %-38s %-10s %-20s %-20s %s\n' "$env" "$home_display" "-" "$email" "$plan" "$usage_5h" "$usage_weekly" "$source"
|
|
1216
1213
|
fi
|
|
1217
1214
|
done < <(list_env_names | sort -u)
|
|
1218
1215
|
}
|
|
@@ -182,10 +182,10 @@ grep -q "EMAIL" /tmp/codex_sw_list_api
|
|
|
182
182
|
grep -q "PLAN" /tmp/codex_sw_list_api
|
|
183
183
|
grep -q "5H USAGE" /tmp/codex_sw_list_api
|
|
184
184
|
grep -q "WEEKLY USAGE" /tmp/codex_sw_list_api
|
|
185
|
-
grep -q "LAST ACTIVITY" /tmp/codex_sw_list_api
|
|
186
185
|
grep -q "SOURCE" /tmp/codex_sw_list_api
|
|
186
|
+
! grep -q "LAST ACTIVITY" /tmp/codex_sw_list_api
|
|
187
187
|
grep -q "personal@example.com" /tmp/codex_sw_list_api
|
|
188
|
-
grep -Eq "[
|
|
188
|
+
grep -Eq "[[:space:]]+api$" /tmp/codex_sw_list_api
|
|
189
189
|
grep -q "60% (" /tmp/codex_sw_list_api
|
|
190
190
|
grep -q "80% (" /tmp/codex_sw_list_api
|
|
191
191
|
grep -Eq "60% \\([0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\\)" /tmp/codex_sw_list_api
|
|
@@ -194,7 +194,7 @@ grep -q "proxy=http://127.0.0.1:7899" "$CODEX_SWITCHER_TEST_CURL_LOG"
|
|
|
194
194
|
|
|
195
195
|
"$SW_LINK" list >/tmp/codex_sw_list_symlink
|
|
196
196
|
grep -q "personal@example.com" /tmp/codex_sw_list_symlink
|
|
197
|
-
grep -Eq "[
|
|
197
|
+
grep -Eq "[[:space:]]+api$" /tmp/codex_sw_list_symlink
|
|
198
198
|
|
|
199
199
|
mkdir -p "$ENVS/project/home/sessions/2026/04/12"
|
|
200
200
|
cat > "$ENVS/project/home/sessions/2026/04/12/rollout-test.jsonl" <<'JSONL'
|
|
@@ -205,7 +205,7 @@ export CODEX_SWITCHER_TEST_CURL_MODE="fail"
|
|
|
205
205
|
[[ "$("$SW" proxy)" == "usage_api_proxy: off" ]]
|
|
206
206
|
: > "$CODEX_SWITCHER_TEST_CURL_LOG"
|
|
207
207
|
"$SW" list >/tmp/codex_sw_list_local
|
|
208
|
-
grep -Eq "[
|
|
208
|
+
grep -Eq "[[:space:]]+local$" /tmp/codex_sw_list_local
|
|
209
209
|
grep -q "75% (" /tmp/codex_sw_list_local
|
|
210
210
|
grep -q "30% (" /tmp/codex_sw_list_local
|
|
211
211
|
grep -Eq "75% \\([0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\\)" /tmp/codex_sw_list_local
|