@wangxt0223/codex-switcher 0.4.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1 - 2026-04-12
4
+
5
+ - Refined README wording for a more conversational background/auth mechanism explanation.
6
+ - Moved command reference from plugin docs to root README in table format.
7
+ - Standardized README title to `codex-switcher`.
8
+ - Removed legacy package-name migration notices from docs.
9
+
3
10
  ## 0.4.0 - 2026-04-12
4
11
 
5
12
  - Changed npm package name to `@wangxt0223/codex-switcher` (CLI command remains `codex-sw`).
package/README.en.md CHANGED
@@ -1,8 +1,8 @@
1
- # codex-sw
1
+ # codex-switcher
2
2
 
3
3
  [中文](README.md) | English
4
4
 
5
- `codex-sw` is a lightweight profile switcher for Codex CLI and Codex App.
5
+ `codex-switcher` is a lightweight profile switcher for Codex CLI and Codex App.
6
6
  It isolates accounts by running each profile in its own `CODEX_HOME` directory.
7
7
 
8
8
  ## Background
@@ -10,7 +10,7 @@ It isolates accounts by running each profile in its own `CODEX_HOME` directory.
10
10
  I originally used Codex for personal work while my company account lived in Cursor, so there was no conflict.
11
11
  After the company migrated from Cursor to Codex, my personal and company Codex accounts started conflicting on the same machine, and switching became unreliable.
12
12
 
13
- After inspecting local behavior, I found Codex's local auth model is straightforward: if account-local data is isolated per directory, account switching becomes stable. Based on that, I built `codex-sw` with Codex to manage, switch, and isolate all my Codex accounts.
13
+ After inspecting local behavior, I found Codex's local auth model is straightforward: if account-local data is isolated per directory, account switching becomes stable. Based on that, I built `codex-switcher` with Codex to manage, switch, and isolate all my Codex accounts.
14
14
 
15
15
  ## Codex Local Auth Model (Summary)
16
16
 
@@ -21,7 +21,7 @@ The following is based on observed local behavior and filesystem layout:
21
21
  - Session/history/state data is also stored under the same `CODEX_HOME` (for example `history.jsonl`, `sessions/`, `state_*.sqlite`).
22
22
  - So when multiple accounts share one `CODEX_HOME`, auth/session data can overwrite or contaminate each other.
23
23
 
24
- `codex-sw` solves this by assigning each account its own `CODEX_HOME` (`~/.codex-profiles/<profile>`) and switching that directory for CLI/App operations.
24
+ `codex-switcher` solves this by assigning each account its own `CODEX_HOME` (`~/.codex-profiles/<profile>`) and switching that directory for CLI/App operations.
25
25
 
26
26
  ## Install
27
27
 
@@ -29,28 +29,28 @@ The following is based on observed local behavior and filesystem layout:
29
29
 
30
30
  ```bash
31
31
  npm i -g @wangxt0223/codex-switcher
32
- codex-sw check
32
+ codex-switcher check
33
33
  ```
34
34
 
35
35
  ### Option B: from source checkout
36
36
 
37
37
  ```bash
38
38
  ./scripts/install.sh
39
- codex-sw check
39
+ codex-switcher check
40
40
  ```
41
41
 
42
42
  ## Quick start
43
43
 
44
44
  ```bash
45
- codex-sw add work
46
- codex-sw add personal
45
+ codex-switcher add work
46
+ codex-switcher add personal
47
47
 
48
- codex-sw use work --sync
49
- codex-sw login --sync
50
- codex-sw exec -- login status
48
+ codex-switcher use work --sync
49
+ codex-switcher login --sync
50
+ codex-switcher exec -- login status
51
51
 
52
- codex-sw switch personal --sync
53
- codex-sw app use personal
52
+ codex-switcher switch personal --sync
53
+ codex-switcher app use personal
54
54
  ```
55
55
 
56
56
  ## Sync options
@@ -81,7 +81,7 @@ npm run release:npm
81
81
  ## Upgrade
82
82
 
83
83
  ```bash
84
- codex-sw upgrade
84
+ codex-switcher upgrade
85
85
  ```
86
86
 
87
87
  ## Docs
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # codex-sw
1
+ # codex-switcher
2
2
 
3
3
  中文 | [English](README.en.md)
4
4
 
5
- `codex-sw` 是一个面向 Codex CLI 与 Codex App 的轻量账号切换工具。
5
+ `codex-switcher` 是一个面向 Codex CLI 与 Codex App 的轻量账号切换工具。
6
6
  它通过为每个 profile 使用独立的 `CODEX_HOME` 目录实现账号隔离。
7
7
 
8
8
  ## 项目背景
@@ -11,18 +11,14 @@
11
11
  后来公司从 Cursor 切到 Codex 后,我就得在同一台电脑上同时用个人账号和公司账号,很快就遇到冲突:登录态会互相覆盖,切换也不顺手。
12
12
 
13
13
  为了搞清楚原因,我看了下 Codex 的本地数据机制,发现思路其实很直接:只要把不同账号对应的本地目录隔离开,就能稳定切换。
14
- 基于这个思路,我用 Codex 写了 `codex-sw`,专门用来管理、切换和隔离我所有的 Codex 账号,现在日常在个人/公司账号之间切换方便很多。
14
+ 基于这个思路,我用 Codex 写了 `codex-switcher`,专门用来管理、切换和隔离我所有的 Codex 账号,现在日常在个人/公司账号之间切换方便很多。
15
15
 
16
16
  ## Codex 本地认证机制(简述)
17
17
 
18
- 以下是基于本地行为和目录结构观察到的机制:
18
+ 简单说就是:Codex 会把“账号登录态 + 会话历史 + 一些本地状态”都放在 `CODEX_HOME` 这个目录里(默认一般是 `~/.codex`)。
19
+ 如果两个账号共用同一个目录,就很容易出现你登我下、我登你下,或者历史数据串在一起的问题。
19
20
 
20
- - `Codex CLI` 与 `Codex App` 都会读取同一个工作目录根:`CODEX_HOME`(默认通常是 `~/.codex`)。
21
- - 账号认证状态主要保存在 `CODEX_HOME/auth.json`。
22
- - 会话、历史、索引和状态等数据也会写在同一 `CODEX_HOME` 下(如 `history.jsonl`、`sessions/`、`state_*.sqlite` 等)。
23
- - 因此当多个账号共享同一个 `CODEX_HOME` 时,最容易出现“登录态互相覆盖/污染”的问题。
24
-
25
- `codex-sw` 的做法就是为每个账号分配独立 `CODEX_HOME`(`~/.codex-profiles/<profile>`),并在执行命令或启动 App 时切换到对应目录,从而实现账号隔离与可控切换。
21
+ `codex-switcher` 做的事情其实不复杂:给每个账号分一个独立目录(`~/.codex-profiles/<profile>`),然后在你执行命令或启动 App 时自动切到对应目录。这样每个账号的数据都各管各的,切换也就稳定了。
26
22
 
27
23
  ## 安装
28
24
 
@@ -30,28 +26,28 @@
30
26
 
31
27
  ```bash
32
28
  npm i -g @wangxt0223/codex-switcher
33
- codex-sw check
29
+ codex-switcher check
34
30
  ```
35
31
 
36
32
  ### 方式 B:源码安装
37
33
 
38
34
  ```bash
39
35
  ./scripts/install.sh
40
- codex-sw check
36
+ codex-switcher check
41
37
  ```
42
38
 
43
39
  ## 快速开始
44
40
 
45
41
  ```bash
46
- codex-sw add work
47
- codex-sw add personal
42
+ codex-switcher add work
43
+ codex-switcher add personal
48
44
 
49
- codex-sw use work --sync
50
- codex-sw login --sync
51
- codex-sw exec -- login status
45
+ codex-switcher use work --sync
46
+ codex-switcher login --sync
47
+ codex-switcher exec -- login status
52
48
 
53
- codex-sw switch personal --sync
54
- codex-sw app use personal
49
+ codex-switcher switch personal --sync
50
+ codex-switcher app use personal
55
51
  ```
56
52
 
57
53
  ## 同步选项
@@ -62,9 +58,33 @@ codex-sw app use personal
62
58
 
63
59
  ## 命令参考
64
60
 
65
- 详见插件文档:
66
- - 中文:`plugins/codex-switcher/README.md`
67
- - English: `plugins/codex-switcher/README.en.md`
61
+ 命令默认用 `codex-switcher`,你也可以继续使用兼容别名 `codex-sw`。
62
+
63
+ | 分类 | 命令 | 说明 |
64
+ | --- | --- | --- |
65
+ | Profile 管理 | `codex-switcher add <profile>` | 新建 profile |
66
+ | Profile 管理 | `codex-switcher remove <profile> [--force]` | 删除 profile |
67
+ | Profile 管理 | `codex-switcher list` | 列出所有 profile |
68
+ | Profile 管理 | `codex-switcher current [cli\|app]` | 查看当前 CLI / App profile |
69
+ | Profile 管理 | `codex-switcher status` | 查看当前 profile 登录状态 |
70
+ | Profile 管理 | `codex-switcher use <profile> [--sync\|--no-sync]` | 切换当前 CLI profile |
71
+ | Profile 管理 | `codex-switcher switch <profile> [--sync\|--no-sync]` | `use` 的等价命令 |
72
+ | 数据迁移 | `codex-switcher import-default <profile> [--with-auth] [--force]` | 从 `~/.codex` 导入数据到 profile |
73
+ | CLI 登录态 | `codex-switcher login [profile] [--sync\|--no-sync]` | 登录指定或当前 CLI profile |
74
+ | CLI 登录态 | `codex-switcher logout [profile]` | 登出指定或当前 CLI profile |
75
+ | CLI 登录态 | `codex-switcher exec -- <codex args...>` | 在当前 CLI profile 下执行 codex 命令 |
76
+ | CLI 登录态 | `codex-switcher env [profile]` | 输出指定 profile 的 `CODEX_HOME` |
77
+ | App 控制 | `codex-switcher app open [profile]` | 用指定 profile 启动 App |
78
+ | App 控制 | `codex-switcher app use <profile>` | 切换 App profile(等价于 open) |
79
+ | App 控制 | `codex-switcher app logout [profile]` | 登出 App profile |
80
+ | App 控制 | `codex-switcher app status` | 查看 App 运行状态 |
81
+ | App 控制 | `codex-switcher app stop` | 停止由工具启动的 App 进程 |
82
+ | App 控制 | `codex-switcher app current` | 查看当前 App profile |
83
+ | 系统维护 | `codex-switcher check` | 基础环境与状态检查 |
84
+ | 系统维护 | `codex-switcher doctor [--fix]` | 诊断并可选自动修复 |
85
+ | 系统维护 | `codex-switcher recover [--dry-run]` | 恢复损坏的 current 指针 |
86
+ | 系统维护 | `codex-switcher init [--shell zsh\|bash] [--dry-run]` | 初始化 PATH 与快捷命令 |
87
+ | 系统维护 | `codex-switcher upgrade [--dry-run]` | 升级到最新版本 |
68
88
 
69
89
  ## 开发
70
90
 
@@ -82,7 +102,7 @@ npm run release:npm
82
102
  ## 升级
83
103
 
84
104
  ```bash
85
- codex-sw upgrade
105
+ codex-switcher upgrade
86
106
  ```
87
107
 
88
108
  ## 文档
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangxt0223/codex-switcher",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Profile-based account switcher for Codex CLI and Codex App using isolated CODEX_HOME directories.",
5
5
  "license": "MIT",
6
6
  "author": "wangxt",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-switcher",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Profile-based account switcher for Codex CLI and Codex App without modifying upstream source.",
5
5
  "author": {
6
6
  "name": "wangxt",
@@ -1,4 +1,4 @@
1
- # codex-sw
1
+ # codex-switcher
2
2
 
3
3
  [中文](README.md) | English
4
4
 
@@ -14,45 +14,45 @@ Profile-based account switcher for Codex CLI and Codex App.
14
14
  ## Commands
15
15
 
16
16
  ```bash
17
- codex-sw add <profile>
18
- codex-sw remove <profile> [--force]
19
- codex-sw list
20
- codex-sw import-default <profile> [--with-auth] [--force]
21
- codex-sw use <profile> [--sync|--no-sync]
22
- codex-sw switch <profile> [--sync|--no-sync]
23
- codex-sw current [cli|app]
24
- codex-sw status
25
-
26
- codex-sw exec -- <codex args...>
27
- codex-sw login [profile] [--sync|--no-sync]
28
- codex-sw logout [profile]
29
- codex-sw env [profile]
30
-
31
- codex-sw app open [profile]
32
- codex-sw app use <profile>
33
- codex-sw app logout [profile]
34
- codex-sw app status
35
- codex-sw app stop
36
-
37
- codex-sw init [--shell zsh|bash]
38
- codex-sw upgrade [--dry-run]
39
- codex-sw recover
40
- codex-sw check
41
- codex-sw doctor [--fix]
17
+ codex-switcher add <profile>
18
+ codex-switcher remove <profile> [--force]
19
+ codex-switcher list
20
+ codex-switcher import-default <profile> [--with-auth] [--force]
21
+ codex-switcher use <profile> [--sync|--no-sync]
22
+ codex-switcher switch <profile> [--sync|--no-sync]
23
+ codex-switcher current [cli|app]
24
+ codex-switcher status
25
+
26
+ codex-switcher exec -- <codex args...>
27
+ codex-switcher login [profile] [--sync|--no-sync]
28
+ codex-switcher logout [profile]
29
+ codex-switcher env [profile]
30
+
31
+ codex-switcher app open [profile]
32
+ codex-switcher app use <profile>
33
+ codex-switcher app logout [profile]
34
+ codex-switcher app status
35
+ codex-switcher app stop
36
+
37
+ codex-switcher init [--shell zsh|bash]
38
+ codex-switcher upgrade [--dry-run]
39
+ codex-switcher recover
40
+ codex-switcher check
41
+ codex-switcher doctor [--fix]
42
42
  ```
43
43
 
44
44
  ## Typical flow
45
45
 
46
46
  ```bash
47
- codex-sw add work
48
- codex-sw add personal
47
+ codex-switcher add work
48
+ codex-switcher add personal
49
49
 
50
- codex-sw use work --sync
51
- codex-sw login --sync
52
- codex-sw exec -- login status
50
+ codex-switcher use work --sync
51
+ codex-switcher login --sync
52
+ codex-switcher exec -- login status
53
53
 
54
- codex-sw switch personal --sync
55
- codex-sw app use personal
54
+ codex-switcher switch personal --sync
55
+ codex-switcher app use personal
56
56
  ```
57
57
 
58
58
  ## Migrate Existing App/CLI Data
@@ -60,14 +60,14 @@ codex-sw app use personal
60
60
  If your existing data is in `~/.codex`, import it into a profile first:
61
61
 
62
62
  ```bash
63
- codex-sw import-default work
63
+ codex-switcher import-default work
64
64
  ```
65
65
 
66
66
  This copies records/projects/history but excludes `auth.json` by default.
67
67
  If you want to carry login state too:
68
68
 
69
69
  ```bash
70
- codex-sw import-default work --with-auth
70
+ codex-switcher import-default work --with-auth
71
71
  ```
72
72
 
73
73
  ## Sync Behavior
@@ -79,27 +79,27 @@ codex-sw import-default work --with-auth
79
79
  Examples:
80
80
 
81
81
  ```bash
82
- codex-sw login work --sync
83
- codex-sw switch personal --sync
84
- codex-sw use work --no-sync
82
+ codex-switcher login work --sync
83
+ codex-switcher switch personal --sync
84
+ codex-switcher use work --no-sync
85
85
  ```
86
86
 
87
87
  ## Upgrade
88
88
 
89
89
  ```bash
90
- codex-sw upgrade
90
+ codex-switcher upgrade
91
91
  ```
92
92
 
93
93
  ## Notes
94
94
 
95
95
  - Codex App is single-instance on macOS; switching App profile requires restart.
96
- - `codex-sw app stop` only stops app instances started and tracked by `codex-sw`.
97
- - `codex-sw app open/use <profile>` requires that profile already exists and is logged in.
96
+ - `codex-switcher app stop` only stops app instances started and tracked by `codex-switcher`.
97
+ - `codex-switcher app open/use <profile>` requires that profile already exists and is logged in.
98
98
  - `--sync` uses overwrite strategy (not merge): source overwrites target for all files except `auth.json`.
99
- - `codex-sw status` exit codes:
99
+ - `codex-switcher status` exit codes:
100
100
  - `0`: both current profiles logged in
101
101
  - `1`: at least one current profile not logged in
102
- - `2`: pointer/profile integrity issue (run `codex-sw recover`)
102
+ - `2`: pointer/profile integrity issue (run `codex-switcher recover`)
103
103
 
104
104
  ## Validation
105
105
 
@@ -109,4 +109,4 @@ codex-sw upgrade
109
109
 
110
110
  ## Compatibility command
111
111
 
112
- `codex-switcher` is kept as a compatibility entrypoint and maps to the same implementation.
112
+ `codex-sw` is kept as a compatibility entrypoint and maps to the same implementation.
@@ -1,4 +1,4 @@
1
- # codex-sw
1
+ # codex-switcher
2
2
 
3
3
  中文 | [English](README.en.md)
4
4
 
@@ -14,45 +14,45 @@
14
14
  ## 命令
15
15
 
16
16
  ```bash
17
- codex-sw add <profile>
18
- codex-sw remove <profile> [--force]
19
- codex-sw list
20
- codex-sw import-default <profile> [--with-auth] [--force]
21
- codex-sw use <profile> [--sync|--no-sync]
22
- codex-sw switch <profile> [--sync|--no-sync]
23
- codex-sw current [cli|app]
24
- codex-sw status
25
-
26
- codex-sw exec -- <codex args...>
27
- codex-sw login [profile] [--sync|--no-sync]
28
- codex-sw logout [profile]
29
- codex-sw env [profile]
30
-
31
- codex-sw app open [profile]
32
- codex-sw app use <profile>
33
- codex-sw app logout [profile]
34
- codex-sw app status
35
- codex-sw app stop
36
-
37
- codex-sw init [--shell zsh|bash]
38
- codex-sw upgrade [--dry-run]
39
- codex-sw recover
40
- codex-sw check
41
- codex-sw doctor [--fix]
17
+ codex-switcher add <profile>
18
+ codex-switcher remove <profile> [--force]
19
+ codex-switcher list
20
+ codex-switcher import-default <profile> [--with-auth] [--force]
21
+ codex-switcher use <profile> [--sync|--no-sync]
22
+ codex-switcher switch <profile> [--sync|--no-sync]
23
+ codex-switcher current [cli|app]
24
+ codex-switcher status
25
+
26
+ codex-switcher exec -- <codex args...>
27
+ codex-switcher login [profile] [--sync|--no-sync]
28
+ codex-switcher logout [profile]
29
+ codex-switcher env [profile]
30
+
31
+ codex-switcher app open [profile]
32
+ codex-switcher app use <profile>
33
+ codex-switcher app logout [profile]
34
+ codex-switcher app status
35
+ codex-switcher app stop
36
+
37
+ codex-switcher init [--shell zsh|bash]
38
+ codex-switcher upgrade [--dry-run]
39
+ codex-switcher recover
40
+ codex-switcher check
41
+ codex-switcher doctor [--fix]
42
42
  ```
43
43
 
44
44
  ## 典型流程
45
45
 
46
46
  ```bash
47
- codex-sw add work
48
- codex-sw add personal
47
+ codex-switcher add work
48
+ codex-switcher add personal
49
49
 
50
- codex-sw use work --sync
51
- codex-sw login --sync
52
- codex-sw exec -- login status
50
+ codex-switcher use work --sync
51
+ codex-switcher login --sync
52
+ codex-switcher exec -- login status
53
53
 
54
- codex-sw switch personal --sync
55
- codex-sw app use personal
54
+ codex-switcher switch personal --sync
55
+ codex-switcher app use personal
56
56
  ```
57
57
 
58
58
  ## 迁移已有数据
@@ -60,14 +60,14 @@ codex-sw app use personal
60
60
  如果你原本在 `~/.codex` 下使用 Codex,可先导入到某个 profile:
61
61
 
62
62
  ```bash
63
- codex-sw import-default work
63
+ codex-switcher import-default work
64
64
  ```
65
65
 
66
66
  默认会迁移记录/项目等数据,但不包含 `auth.json`。
67
67
  如需连登录态一起导入:
68
68
 
69
69
  ```bash
70
- codex-sw import-default work --with-auth
70
+ codex-switcher import-default work --with-auth
71
71
  ```
72
72
 
73
73
  ## 同步行为
@@ -79,27 +79,27 @@ codex-sw import-default work --with-auth
79
79
  示例:
80
80
 
81
81
  ```bash
82
- codex-sw login work --sync
83
- codex-sw switch personal --sync
84
- codex-sw use work --no-sync
82
+ codex-switcher login work --sync
83
+ codex-switcher switch personal --sync
84
+ codex-switcher use work --no-sync
85
85
  ```
86
86
 
87
87
  ## 升级
88
88
 
89
89
  ```bash
90
- codex-sw upgrade
90
+ codex-switcher upgrade
91
91
  ```
92
92
 
93
93
  ## 说明
94
94
 
95
95
  - macOS 下 Codex App 是单实例;切换 App profile 需要重启。
96
- - `codex-sw app stop` 仅停止由 `codex-sw` 启动并跟踪的 App 进程。
97
- - `codex-sw app open/use <profile>` 要求该 profile 已存在且已登录。
96
+ - `codex-switcher app stop` 仅停止由 `codex-switcher` 启动并跟踪的 App 进程。
97
+ - `codex-switcher app open/use <profile>` 要求该 profile 已存在且已登录。
98
98
  - `--sync` 为覆盖策略(不是合并):源目录覆盖目标目录,`auth.json` 除外。
99
- - `codex-sw status` 返回码:
99
+ - `codex-switcher status` 返回码:
100
100
  - `0`:当前 CLI/App profile 均已登录
101
101
  - `1`:至少一个当前 profile 未登录
102
- - `2`:指针或 profile 完整性异常(可执行 `codex-sw recover`)
102
+ - `2`:指针或 profile 完整性异常(可执行 `codex-switcher recover`)
103
103
 
104
104
  ## 验证
105
105
 
@@ -109,4 +109,4 @@ codex-sw upgrade
109
109
 
110
110
  ## 兼容命令
111
111
 
112
- `codex-switcher` 作为兼容入口保留,行为与 `codex-sw` 一致。
112
+ `codex-sw` 作为兼容入口保留,行为与 `codex-switcher` 一致。