Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 35 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ permissions:

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
- platform: ubuntu-22.04
- platform: windows-latest

runs-on: ${{ matrix.platform }}
runs-on: windows-latest

steps:
- name: Checkout
Expand All @@ -34,33 +26,45 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Install Linux dependencies
if: startsWith(matrix.platform, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf

- name: Install dependencies
run: npm ci

- name: Build & Release
uses: tauri-apps/tauri-action@v0
- name: Build installer
run: npm run tauri:build:windows

- name: Prepare release asset
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
mkdir -p release-assets
matches=(src-tauri/target/release/bundle/nsis/*.exe)
if [ "${#matches[@]}" -ne 1 ]; then
printf 'Expected one asset for src-tauri/target/release/bundle/nsis/*.exe, found %s\n' "${#matches[@]}"
printf '%s\n' "${matches[@]}"
exit 1
fi
version="${GITHUB_REF_NAME#v}"
asset_name="codex-manager_${version}_x64-setup.exe"
cp "${matches[0]}" "release-assets/${asset_name}"
printf 'ASSET_PATH=release-assets/%s\n' "${asset_name}" >> "${GITHUB_ENV}"

- name: Create release
if: startsWith(github.ref, 'refs/tags/')
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: "Codex Manager ${{ github.ref_name }}"
releaseBody: "See the assets to download and install this version."
releaseDraft: false
prerelease: false
run: |
if ! gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release create "${GITHUB_REF_NAME}" \
--title "Codex Manager ${GITHUB_REF_NAME}" \
--notes "See the assets to download and install this version." || \
gh release view "${GITHUB_REF_NAME}" >/dev/null
fi

- name: Upload macOS Unix helper
if: matrix.platform == 'macos-latest' && startsWith(github.ref, 'refs/tags/')
- name: Upload installer
if: startsWith(github.ref, 'refs/tags/')
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${GITHUB_REF_NAME}" scripts/install-unix-cli.sh --clobber
run: gh release upload "${GITHUB_REF_NAME}" "${ASSET_PATH}" --clobber
25 changes: 11 additions & 14 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,27 @@ Codex Manager reduces both to a few desktop and tray actions.

## Installation

Recommended: download a packaged build from GitHub Releases.
Recommended: download the Windows packaged build from GitHub Releases.

- Windows: `.msi` or `.exe`
- macOS: `.dmg`
- Linux: `.deb`, `.rpm`, or `.AppImage`
- Windows: `codex-manager_<version>_x64-setup.exe`

Releases: <https://github.com/davaded/codex-manager/releases>

For macOS, build the DMG locally with `npm run tauri:build:macos`. The output is written to `src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/`.

### CLI Availability

After installation, the `codex-manager` command behaves like this:

| Platform | Recommended package | CLI availability |
| --- | --- | --- |
| Windows | `.exe` or `.msi` | Installed to `PATH` automatically |
| macOS | `.dmg` | Use the bundled helper script once |
| Linux | `.deb` or `.rpm` | Available directly as `codex-manager` |
| Linux | `.AppImage` | Use the helper script once, or keep it portable |
| Windows | `codex-manager_<version>_x64-setup.exe` | Installed to `PATH` automatically |
| macOS | Locally built `codex-manager_<version>_aarch64.dmg` | Use the repo helper script to add it to `PATH` |

Notes:

- On Windows, reopen your terminal after installation so the new `PATH` is picked up.
- On macOS, the release ships as a `.dmg`. If you also want a global `codex-manager` command, run the bundled helper script once after dragging the app into `/Applications`.
- On Linux, prefer `.deb` or `.rpm` if you want a package-managed CLI experience.
- After building the macOS DMG locally, if you also want a global `codex-manager` command, drag the app into `/Applications`, then run `scripts/install-unix-cli.sh` from this repo.
- The app reads and writes `~/.codex/auth.json`, so Codex CLI should already be installed and working.

## Command Line Switching
Expand All @@ -89,7 +86,7 @@ The CLI updates both the managed `accounts.json` state and the live `~/.codex/au

If Codex CLI or the desktop app is already running, restart it after switching so the new auth takes effect.

For `.dmg` and `.AppImage` installs, the release helper script can expose the command globally:
For `.dmg` installs, the repo helper script can expose the command globally:

```bash
sudo bash ./install-unix-cli.sh /Applications/codex-manager.app /usr/local/bin/codex-manager
Expand Down Expand Up @@ -141,9 +138,9 @@ If the auth state already belongs to an existing account, the app updates that a

Current rule set:

- Prefer the account with the lowest `5h` usage
- If `5h` usage is tied, compare weekly usage
- If the active account is already the best choice, do nothing
- Switch when the active account has less than 5% `5h` quota left, or less than 2% weekly quota left
- Candidate accounts must have valid quota data
- Candidate accounts are ranked by `5h` remaining quota first, then weekly remaining quota

## Token Tracking

Expand Down
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,27 @@ Codex Manager 把这些操作收敛成桌面窗口、托盘面板和命令行里

## 安装

推荐直接从 GitHub Releases 下载打包产物
推荐直接从 GitHub Releases 下载 Windows 打包产物

- Windows:`.msi` 或 `.exe`
- macOS:`.dmg`
- Linux:`.deb`、`.rpm` 或 `.AppImage`
- Windows:`codex-manager_<版本号>_x64-setup.exe`

下载地址:<https://github.com/davaded/codex-manager/releases>

macOS 安装包请在本机执行 `npm run tauri:build:macos` 构建,产物位于 `src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/`。

### 安装后 CLI 可用性

安装完成后,`codex-manager` 命令在各平台的行为如下:

| 平台 | 推荐安装包 | CLI 可用性 |
| --- | --- | --- |
| Windows | `.exe` 或 `.msi` | 自动加入 `PATH` |
| macOS | `.dmg` | 需要额外执行一次 helper 脚本 |
| Linux | `.deb` 或 `.rpm` | 安装后可直接使用 `codex-manager` |
| Linux | `.AppImage` | 需要额外执行一次 helper 脚本,或保持便携运行 |
| Windows | `codex-manager_<版本号>_x64-setup.exe` | 自动加入 `PATH` |
| macOS | 本地构建的 `codex-manager_<版本号>_aarch64.dmg` | 可使用仓库脚本加入 `PATH` |

说明:

- Windows 安装后请重新打开一个终端窗口,让新的 `PATH` 生效。
- macOS 版本只提供 `.dmg`。如果还希望在 Terminal 里直接使用 `codex-manager`,把应用拖到 `/Applications` 后再执行一次 helper 脚本即可。
- Linux 如果希望获得最稳定的系统级 CLI 体验,优先使用 `.deb` 或 `.rpm`。
- macOS 本地 DMG 构建完成后,如果还希望在 Terminal 里直接使用 `codex-manager`,把应用拖到 `/Applications` 后再执行仓库里的 `scripts/install-unix-cli.sh`。
- 应用会读写 `~/.codex/auth.json`,所以机器上需要先能正常使用 Codex CLI。

## 命令行切换
Expand All @@ -89,7 +86,7 @@ CLI 会同时更新受管账号状态和当前生效的 `~/.codex/auth.json`。

如果 Codex CLI 或桌面应用已经在运行,切换后请重启它们,让新的 auth 生效。

对于 `.dmg` 和 `.AppImage` 安装方式,可以使用发布包里的 helper 脚本暴露全局命令:
对于 `.dmg` 安装方式,可以使用仓库里的 helper 脚本暴露全局命令:

```bash
sudo bash ./install-unix-cli.sh /Applications/codex-manager.app /usr/local/bin/codex-manager
Expand Down Expand Up @@ -141,9 +138,9 @@ npm link

当前规则:

- 优先选择 `5h` 使用比例更低的账号
- 如果 `5h` 相同,再比较每周使用比例
- 如果当前账号已经是最佳选择,则不重复切换
- 当前账号 `5h` 剩余小于 5%,或每周剩余小于 2% 时触发切换
- 候选账号必须拥有有效额度数据
- 候选账号按 `5h` 剩余优先、每周剩余次之排序

## Token 统计

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codex-manager",
"version": "1.2.4",
"version": "1.2.19",
"type": "module",
"bin": {
"codex-manager": "./bin/codex-manager.mjs",
Expand All @@ -12,6 +12,8 @@
"build": "tsc && vite build",
"test": "vitest run",
"preview": "vite preview",
"tauri:build:windows": "tauri build --bundles nsis",
"tauri:build:macos": "tauri build --target aarch64-apple-darwin --bundles dmg",
"tauri": "tauri"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "codex-manager"
version = "1.2.4"
version = "1.2.19"
edition = "2021"
default-run = "codex-manager"

Expand Down
Loading