Skip to content

Commit b9c5099

Browse files
committed
Release 1.5.3 macOS packaging and UI updates
1 parent 22d4219 commit b9c5099

35 files changed

Lines changed: 3455 additions & 399 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Local temp/test outputs
1111
*.log
1212
tmp/
13+
.tmp/
1314
.venv/
1415
.pytest_cache/
1516
__pycache__/
@@ -19,5 +20,6 @@ src-tauri/target/
1920
src-tauri/gen/
2021
local_doc/
2122
agent/
23+
codex_history/
2224
.codex/
2325
docs/

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 1.5.3 - 2026-04-27
4+
5+
- Added real update checks against the configured GitHub latest-release JSON endpoint.
6+
- Added automatic new-version prompting when the latest release is newer than the running app.
7+
- Fixed update version parsing so historical two-part tags such as `1.5` compare as `1.5.0` instead of failing.
8+
- Added macOS `.pkg` packaging alongside `.app` and `.dmg`.
9+
- Standardized future release records on full three-part semantic versions.
10+
11+
## 1.5.2 - 2026-04-21
12+
13+
- Windows installer uploaded as `codex_switch_1.5.2_x64-setup.exe`.
14+
- Historical note: this asset was uploaded under the non-standard GitHub Release tag `1.5`.
15+
16+
## 1.5.1 - 2026-04-21
17+
18+
- Windows installer uploaded as `codex_switch_1.5.1_x64-setup.exe`.
19+
- Historical note: this asset was uploaded under the non-standard GitHub Release tag `1.5`.
20+
21+
## 1.5.0 - 2026-04-20
22+
23+
- Added normalized installation and version-control release.
24+
- Uploaded macOS DMG and Windows installer assets.
25+
- Historical note: the GitHub Release tag was created as `1.5`; future release tags should use full semantic versions such as `1.5.3`.
26+
327
## 1.4.2 - 2026-04-16
428

529
- Added the new local release after GitHub tag `1.4.1`.

README.md

Lines changed: 102 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,146 @@
1-
# Codex Account Switch
1+
# Codex 账号切换工具
22

3-
中文文档: [README.zh-CN.md](./README.zh-CN.md)
3+
Codex 账号切换工具是一个本地桌面应用,用来在同一台机器上管理多个 Codex 账号。它通过本地账号备份目录保存不同账号状态,支持切换当前账号、查看账号状态和额度信息,并提供 macOS 与 Windows 原生 Tauri 桌面界面。
44

5-
This repository packages a local multi-account Codex switching workflow: macOS now keeps the retained command-line flow under `macOS-backup/`, with `macOS-backup/install.sh` acting as a compatibility entry that prefers the native desktop runtime when available and falls back to the legacy shell flow, while Windows uses a native desktop app.
5+
`macOS-backup/` 里的 shell 脚本仍然保留,作为兼容旧流程的入口;当前主要方向是原生桌面端。
66

7-
## Features
7+
## 当前功能
88

9-
- Automatically save the current active account after login, then switch accounts with one click
10-
- Close the Codex desktop app before switching and relaunch it afterward when needed
11-
- Use the Windows control panel for switching, login, opening folders, adding profiles, and related actions
9+
- 仪表盘:显示当前账号、账号总数、可用账号和待登录账号数量。
10+
- 账号页:每页 4 张账号卡片,支持切换、登录刷新、重命名、删除或清空、打开账号目录、编辑 Base URL。
11+
- 运行时页:先放置运行时可视化界面,后续再接入更多后端能力。
12+
- 设置页:包含语言、主题、端口、开机自启占位、更新地址、配置备份、版本、许可证、检查更新和 GitHub 入口。
13+
- 引导页:展示添加账号、登录、切换账号的基础流程。
14+
- 支持多套浅色和深色主题、中英文界面,以及没有 Tauri API 时的本地预览数据。
1215

13-
## Platform support
16+
部分设置项和运行时条目目前只完成前端界面,后续再接入后端。
1417

15-
- macOS: compatibility shell scripts under [`macOS-backup/`](./macOS-backup)
16-
- Windows: the `.exe` desktop application from the repository release
18+
## 平台支持
1719

18-
## Repository layout
20+
- macOS:原生 Tauri 桌面端,同时保留 `macOS-backup/` 下的兼容脚本。
21+
- Windows:原生 Tauri 桌面端,通过 Release 中的 `.exe` 分发。
1922

20-
- [`macOS-backup/`](./macOS-backup): retained macOS compatibility installer, native desktop bridge scripts, and legacy shell fallback
21-
- [`src-tauri/`](./src-tauri/): Rust/Tauri runtime root
22-
- [`src-tauri/win/front/`](./src-tauri/win/front/): Windows desktop frontend shell
23-
- [`src-tauri/mac/front/`](./src-tauri/mac/front/): macOS desktop frontend shell
24-
- [`src-tauri/shared/front/`](./src-tauri/shared/front/): shared frontend bridge modules and font assets
25-
- [`src-tauri/win/runtime/`](./src-tauri/win/runtime/): Windows-only runtime code
26-
- [`src-tauri/mac/runtime/`](./src-tauri/mac/runtime/): macOS-only runtime code
27-
- [`src-tauri/shared/runtime/`](./src-tauri/shared/runtime/): shared CLI, models, errors, and runtime logic
28-
- [`src-tauri/shared/platform/`](./src-tauri/shared/platform/): cross-platform lifecycle hook layer
29-
- [`src-tauri/shared/commands/`](./src-tauri/shared/commands/): shared Tauri command handlers
30-
- [`src-tauri/src/`](./src-tauri/src/): crate entrypoints kept for Cargo/Tauri conventions
31-
- [`examples/account_backup/demo/`](./examples/account_backup/demo/): placeholder `auth.json` template
32-
- [`docs/`](./docs/): implementation and security notes
33-
- [`windows/`](./windows/): historical Windows note
23+
平台专属逻辑优先放在 `src-tauri/mac/**``src-tauri/win/**` 下。`src-tauri/shared/**` 只放共享前端模块、命令契约、运行时模型和中立的跨平台逻辑。
3424

35-
## macOS installation
25+
## 仓库结构
26+
27+
- `src-tauri/`:Rust 与 Tauri 应用根目录。
28+
- `src-tauri/mac/front/`:macOS HTML 壳、样式和窗口控制。
29+
- `src-tauri/win/front/`:Windows HTML 壳、样式和窗口控制。
30+
- `src-tauri/shared/front/`:共享前端状态、渲染、动作、主题、国际化和 Tauri 桥接。
31+
- `src-tauri/mac/runtime/`:macOS 运行时集成。
32+
- `src-tauri/win/runtime/`:Windows 运行时集成。
33+
- `src-tauri/shared/runtime/`:共享模型、账号数据处理、更新检查、路径、元数据和切换核心逻辑。
34+
- `src-tauri/shared/commands/`:暴露给前端的 Tauri 命令处理层。
35+
- `macOS-backup/`:旧 shell 流程和桌面桥接的兼容安装、卸载脚本。
36+
- `examples/account_backup/demo/`:示例 `auth.json` 模板。
37+
- `scripts/`:版本同步、macOS 产物布局和 macOS `.pkg` 生成脚本。
38+
39+
生成文件不进仓库。前端网页构建输出放在 `dist/web/`,macOS 桌面端打包产物直接落到 `dist/` 根目录。
40+
41+
## 开发
42+
43+
安装依赖:
3644

3745
```bash
38-
cd ~/.../Codex_Account_Switch
39-
bash macOS-backup/install.sh
40-
source ~/.zshrc
46+
npm install
4147
```
4248

43-
The compatibility installer supports three modes:
49+
启动前端和 Tauri 开发应用:
4450

45-
- `auto` (default): prefer the native desktop installer when a macOS runtime binary is available, otherwise fall back to the legacy shell installer
46-
- `desktop`: require the native desktop installer path and fail if it cannot be found
47-
- `legacy`: force the original shell-based `codex-switch.sh` flow
51+
```bash
52+
npm run tauri:dev
53+
```
4854

49-
Examples:
55+
只构建前端:
5056

5157
```bash
52-
bash macOS-backup/install.sh --mode auto
53-
bash macOS-backup/install.sh --mode desktop
54-
bash macOS-backup/install.sh --mode legacy
58+
npm run build
5559
```
5660

57-
In desktop mode, the installer:
61+
运行 Rust 测试:
5862

59-
- delegates to the native `codex_switch` installer
60-
- keeps the real runtime under `~/.codex/account_backup/macos/`
61-
- writes the managed `~/.codex/bin/codex` shim through the native runtime
62-
- injects a PATH hook into `~/.zshrc` so the managed shim is available in the shell
63+
```bash
64+
npm run test:rust
65+
```
6366

64-
In legacy mode, the installer keeps the original shell behavior:
67+
## 桌面端打包
6568

66-
- copies `macOS-backup/codex-switch.sh` to `~/.codex/account_backup/codex-switch.sh`
67-
- creates `~/.codex/account_backup/a` through `~/.codex/account_backup/d`
68-
- writes the example auth template into any missing `~/.codex/account_backup/<profile>/auth.json`
69-
- copies the current `~/.codex/auth.json` to `~/.codex/account_backup/a/auth.json` when available
70-
- initializes profile `a` as the active profile if a real root auth file exists and no active profile is set yet
71-
- injects a `codex()` wrapper into `~/.zshrc`
69+
Tauri 2 没有提供 bundle 输出目录配置。macOS 打包脚本会在运行 Tauri 前,把 `src-tauri/target/release/bundle/macos``src-tauri/target/release/bundle/dmg` 准备成指向 `dist/` 的链接。Tauri 仍然写入它自己的固定 bundle 路径,但实际 `.app``.dmg` 会直接落到 `dist/``.pkg` 生成脚本也直接写入 `dist/`
7270

73-
## Windows installation
71+
本地测试阶段只打包 `.app`
7472

75-
- Download the latest `.exe` desktop application from this repository's Releases page
73+
```bash
74+
npm run tauri:build:macos-app
75+
```
7676

77-
## Local macOS packaging
77+
`.app` 写入 `dist/` 后,会删除构建过程中生成的裸 macOS 可执行中间产物。
7878

79-
To generate a drag-install `.dmg` locally:
79+
最终发布阶段打包 `.dmg` `.pkg`
8080

8181
```bash
82-
npm run tauri:build:macos-dmg
82+
npm run tauri:build:macos-release
8383
```
8484

85-
The build outputs land at:
85+
最终发布流程会把 `.app` 作为打包输入,随后从 `dist/` 中移除 `.app`,只把发布用安装包保留在 `dist/` 根目录。`dist/` 根目录里的旧版本 `.dmg``.pkg` 会移动到 `dist/history/` 下对应的版本命名文件夹中;重复构建当前版本时会替换当前根目录安装包,不再额外备份。
8686

87-
- `src-tauri/target/release/bundle/macos/codex_switch.app`
88-
- `src-tauri/target/release/bundle/macos/codex_switch_*.dmg`
89-
90-
## macOS usage
87+
预期本地产物结构:
9188

9289
```text
93-
Open Terminal
94-
codex switch list List available accounts
95-
codex switch a Switch to the account under folder a
96-
codex switch b Switch to the account under folder b
90+
dist/
91+
codex_switch_<version>_<arch>.dmg
92+
codex_switch_<version>_<arch>.pkg
93+
history/
94+
v<old-version>/
95+
...
96+
web/
97+
...
98+
```
99+
100+
## 版本与发布
101+
102+
- 项目版本保存在 `package.json`,并同步到 Tauri 和 Cargo 元数据。
103+
- GitHub Release 标签使用完整语义版本号,例如 `1.5.3`
104+
- 每个补丁版本单独创建一个 Release 标签。
105+
- 不要把补丁版本产物上传到旧的两段式标签下,例如不要继续把 `1.5.x` 上传到 `1.5`
106+
- macOS 安装包作为 Release 资产发布,不提交到 Git。
107+
108+
常用命令:
109+
110+
```bash
111+
npm run version:sync
112+
npm run version:set -- 1.5.4
97113
```
98114

99-
If you want to add profiles beyond the default `a` through `d`, create the target folder manually first, put a valid `auth.json` inside it, and then run the switch command.
115+
## macOS 兼容脚本
100116

101-
## macOS uninstall
117+
通过兼容入口安装:
118+
119+
```bash
120+
bash macOS-backup/install.sh
121+
source ~/.zshrc
122+
```
123+
124+
支持三种模式:
125+
126+
- `auto`:优先尝试原生桌面运行时,找不到时回退到 legacy shell 流程。
127+
- `desktop`:强制使用原生桌面运行时。
128+
- `legacy`:强制使用原来的 shell 版 `codex-switch.sh` 流程。
129+
130+
卸载:
102131

103132
```bash
104133
bash macOS-backup/uninstall.sh
105134
bash macOS-backup/uninstall.sh --remove-script
106135
source ~/.zshrc
107136
```
108137

109-
The compatibility uninstaller also supports `--mode auto|desktop|legacy`.
138+
卸载脚本只移除受管理的命令接入层,不会删除账号备份目录;账号目录需要时手动清理。
139+
140+
## Windows 安装
141+
142+
在仓库 Releases 页面下载最新 Windows `.exe`
143+
144+
## 账号数据
110145

111-
- In desktop mode it removes the native shell hook first, then delegates to the native runtime uninstaller.
112-
- In legacy mode it removes the original shell wrapper block.
113-
- The default uninstall removes only managed command hooks. It does not delete your account folders unless you remove them manually.
146+
账号数据只保存在本机。导出的配置或账号备份可能包含 API Key 或认证数据,只应保存在可信设备上。

0 commit comments

Comments
 (0)