codex-workspaces 0.3.0__tar.gz → 0.3.1__tar.gz
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.
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/CHANGELOG.md +17 -1
- {codex_workspaces-0.3.0/src/codex_workspaces.egg-info → codex_workspaces-0.3.1}/PKG-INFO +15 -2
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/README.MD +14 -1
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/README.zh-CN.md +14 -1
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/docs/DESIGN.zh-CN.md +9 -3
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/docs/RELEASE.zh-CN.md +2 -2
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/docs/TESTING.zh-CN.md +16 -2
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/pyproject.toml +1 -1
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/__init__.py +1 -1
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/cli.py +27 -5
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/config.py +8 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/core.py +424 -33
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1/src/codex_workspaces.egg-info}/PKG-INFO +15 -2
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/tests/test_cli.py +7 -2
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/tests/test_core.py +135 -4
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/MANIFEST.in +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/setup.cfg +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/__main__.py +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/errors.py +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/platforms.py +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/stats.py +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces/store.py +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces.egg-info/SOURCES.txt +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces.egg-info/dependency_links.txt +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces.egg-info/entry_points.txt +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces.egg-info/requires.txt +0 -0
- {codex_workspaces-0.3.0 → codex_workspaces-0.3.1}/src/codex_workspaces.egg-info/top_level.txt +0 -0
|
@@ -4,6 +4,22 @@ All notable changes to `codex-workspaces` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project follows a simple changelog format while it is still pre-release.
|
|
6
6
|
|
|
7
|
+
## 0.3.1 - 2026-07-04
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added `accounts add <account> --login` and `accounts login-temp <account>` to create an isolated temporary login workspace, save the new auth snapshot, and restore the previous workspace.
|
|
12
|
+
- Added `accounts cleanup-login-temp` for stale temporary login workspaces.
|
|
13
|
+
- Added enhanced `accounts list` and `accounts info` output with auth status, current/default markers, workspace references, orphan/active-only status, notes, paths, and auth hashes.
|
|
14
|
+
- Added account-focused `doctor` checks for missing account references, workspace auth without defaults, orphan accounts, permission issues, and legacy directory leftovers.
|
|
15
|
+
- Added final migration report summaries for migrated workspaces, created accounts, imported accounts, renamed account conflicts, and skipped special files.
|
|
16
|
+
- Added `codex-workspaces info <workspace>` for workspace metadata inspection.
|
|
17
|
+
- Added `CODEX_WORKSPACES_RESTORE_POLICY` with `workspace-default`, `last-active`, and `keep-current`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Updated README, design, testing, and release docs for the 0.3.1 account and restore-policy workflow.
|
|
22
|
+
|
|
7
23
|
## 0.3.0 - 2026-07-04
|
|
8
24
|
|
|
9
25
|
### Added
|
|
@@ -40,7 +56,7 @@ This project follows a simple changelog format while it is still pre-release.
|
|
|
40
56
|
- Delegates stop, switch, and restart commands to Terminal.app when they are run from a detected Codex terminal environment.
|
|
41
57
|
- Refuses start and migration commands when they are run from a detected Codex terminal environment.
|
|
42
58
|
- Backs up legacy workspace/account sources before migration and never deletes old directories automatically.
|
|
43
|
-
- Keeps
|
|
59
|
+
- Keeps migration non-interactive; new account login is handled separately through the login-temp workflow.
|
|
44
60
|
- Saves live `auth.json` before account or workspace switches when an active account is configured.
|
|
45
61
|
- Uses a lock file under `~/.codex-workspaces/lock` for account and workspace switching.
|
|
46
62
|
- Limits workspace names to letters, numbers, dots, underscores, and hyphens.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codex-workspaces
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Cross-platform Codex workspace switcher with a preserved macOS shell workflow.
|
|
5
5
|
Author: blockchain-project-lives
|
|
6
6
|
Project-URL: Homepage, https://github.com/blockchain-project-lives/codex-workspaces
|
|
@@ -45,7 +45,9 @@ On macOS, the Python CLI preserves the original app workflow: stop Codex App, sw
|
|
|
45
45
|
- Manage account snapshots under `~/.codex-workspaces/accounts/`.
|
|
46
46
|
- Switch the active `~/.codex` symlink or directory link.
|
|
47
47
|
- Initialize workspace directories with metadata.
|
|
48
|
+
- Add a new account through an isolated temporary login workspace with `accounts add --login`.
|
|
48
49
|
- Temporarily switch the current workspace account with `accounts use`, then restore the workspace default account.
|
|
50
|
+
- Inspect workspace/account metadata and run account-focused `doctor` diagnostics.
|
|
49
51
|
- Migrate older `~/.codex-<name>` workspaces and import legacy `~/.codex-accounts` auth snapshots.
|
|
50
52
|
- Keep macOS Codex App stop/start/restart support.
|
|
51
53
|
- Show local token usage stats from Codex `state_*.sqlite` in read-only mode.
|
|
@@ -149,6 +151,14 @@ codex-workspaces accounts init research
|
|
|
149
151
|
codex-workspaces accounts save research
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
To add a new account without logging out of the current workspace account, use a temporary login workspace:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
codex-workspaces accounts add research --login
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This switches `~/.codex` to a temporary `login-<account>` workspace, lets you log in, saves the generated `auth.json` as `acct_<account>`, and restores the previous workspace. If login is interrupted, clean stale temporary workspaces with `codex-workspaces accounts cleanup-login-temp`.
|
|
161
|
+
|
|
152
162
|
Import legacy `codex-accounts` AUTH-mode snapshots:
|
|
153
163
|
|
|
154
164
|
```bash
|
|
@@ -174,6 +184,7 @@ Inspect workspaces:
|
|
|
174
184
|
```bash
|
|
175
185
|
codex-workspaces list
|
|
176
186
|
codex-workspaces current
|
|
187
|
+
codex-workspaces info work
|
|
177
188
|
codex-workspaces doctor
|
|
178
189
|
codex-workspaces stats
|
|
179
190
|
codex-workspaces stats work --days 14
|
|
@@ -186,7 +197,7 @@ codex-workspaces accounts use acct_personal
|
|
|
186
197
|
codex-workspaces accounts restore-default
|
|
187
198
|
```
|
|
188
199
|
|
|
189
|
-
`accounts use` only changes the current workspace `active_account_id`; it does not change `default_account_id`. Entering a workspace
|
|
200
|
+
`accounts use` only changes the current workspace `active_account_id`; it does not change `default_account_id`. Entering a workspace uses `CODEX_WORKSPACES_RESTORE_POLICY`: `workspace-default` restores the workspace default account, `last-active` restores that workspace's last active account, and `keep-current` keeps the account you were just using when possible.
|
|
190
201
|
|
|
191
202
|
`auth.json` contains credentials. Do not commit workspace directories, account snapshots, SQLite state, sessions, or shell snapshots to git; the project `.gitignore` excludes these patterns for local checkouts.
|
|
192
203
|
|
|
@@ -194,6 +205,7 @@ Manage account metadata and snapshots:
|
|
|
194
205
|
|
|
195
206
|
```bash
|
|
196
207
|
codex-workspaces accounts note acct_research "lab account"
|
|
208
|
+
codex-workspaces accounts info acct_research
|
|
197
209
|
codex-workspaces accounts rename acct_research acct_lab
|
|
198
210
|
codex-workspaces accounts delete acct_lab --force
|
|
199
211
|
```
|
|
@@ -226,6 +238,7 @@ codex-workspaces restart
|
|
|
226
238
|
| `CODEX_QUIT_TIMEOUT` | `20` | Seconds to wait for app exit. |
|
|
227
239
|
| `CODEX_WORKSPACES_LINK` | `$HOME/.codex` | Active workspace link path. |
|
|
228
240
|
| `CODEX_WORKSPACES_ROOT` | `$HOME/.codex-workspaces` | Managed root for workspaces, accounts, backups, and lock file. |
|
|
241
|
+
| `CODEX_WORKSPACES_RESTORE_POLICY` | `workspace-default` | Account restore policy when entering a workspace: `workspace-default`, `last-active`, or `keep-current`. |
|
|
229
242
|
| `CODEX_WORKSPACES_LANG` | auto | Force output language with `en` or `zh`. |
|
|
230
243
|
|
|
231
244
|
Only the `CODEX_WORKSPACES_*` variables are used for workspace-specific configuration.
|
|
@@ -17,7 +17,9 @@ On macOS, the Python CLI preserves the original app workflow: stop Codex App, sw
|
|
|
17
17
|
- Manage account snapshots under `~/.codex-workspaces/accounts/`.
|
|
18
18
|
- Switch the active `~/.codex` symlink or directory link.
|
|
19
19
|
- Initialize workspace directories with metadata.
|
|
20
|
+
- Add a new account through an isolated temporary login workspace with `accounts add --login`.
|
|
20
21
|
- Temporarily switch the current workspace account with `accounts use`, then restore the workspace default account.
|
|
22
|
+
- Inspect workspace/account metadata and run account-focused `doctor` diagnostics.
|
|
21
23
|
- Migrate older `~/.codex-<name>` workspaces and import legacy `~/.codex-accounts` auth snapshots.
|
|
22
24
|
- Keep macOS Codex App stop/start/restart support.
|
|
23
25
|
- Show local token usage stats from Codex `state_*.sqlite` in read-only mode.
|
|
@@ -121,6 +123,14 @@ codex-workspaces accounts init research
|
|
|
121
123
|
codex-workspaces accounts save research
|
|
122
124
|
```
|
|
123
125
|
|
|
126
|
+
To add a new account without logging out of the current workspace account, use a temporary login workspace:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
codex-workspaces accounts add research --login
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
This switches `~/.codex` to a temporary `login-<account>` workspace, lets you log in, saves the generated `auth.json` as `acct_<account>`, and restores the previous workspace. If login is interrupted, clean stale temporary workspaces with `codex-workspaces accounts cleanup-login-temp`.
|
|
133
|
+
|
|
124
134
|
Import legacy `codex-accounts` AUTH-mode snapshots:
|
|
125
135
|
|
|
126
136
|
```bash
|
|
@@ -146,6 +156,7 @@ Inspect workspaces:
|
|
|
146
156
|
```bash
|
|
147
157
|
codex-workspaces list
|
|
148
158
|
codex-workspaces current
|
|
159
|
+
codex-workspaces info work
|
|
149
160
|
codex-workspaces doctor
|
|
150
161
|
codex-workspaces stats
|
|
151
162
|
codex-workspaces stats work --days 14
|
|
@@ -158,7 +169,7 @@ codex-workspaces accounts use acct_personal
|
|
|
158
169
|
codex-workspaces accounts restore-default
|
|
159
170
|
```
|
|
160
171
|
|
|
161
|
-
`accounts use` only changes the current workspace `active_account_id`; it does not change `default_account_id`. Entering a workspace
|
|
172
|
+
`accounts use` only changes the current workspace `active_account_id`; it does not change `default_account_id`. Entering a workspace uses `CODEX_WORKSPACES_RESTORE_POLICY`: `workspace-default` restores the workspace default account, `last-active` restores that workspace's last active account, and `keep-current` keeps the account you were just using when possible.
|
|
162
173
|
|
|
163
174
|
`auth.json` contains credentials. Do not commit workspace directories, account snapshots, SQLite state, sessions, or shell snapshots to git; the project `.gitignore` excludes these patterns for local checkouts.
|
|
164
175
|
|
|
@@ -166,6 +177,7 @@ Manage account metadata and snapshots:
|
|
|
166
177
|
|
|
167
178
|
```bash
|
|
168
179
|
codex-workspaces accounts note acct_research "lab account"
|
|
180
|
+
codex-workspaces accounts info acct_research
|
|
169
181
|
codex-workspaces accounts rename acct_research acct_lab
|
|
170
182
|
codex-workspaces accounts delete acct_lab --force
|
|
171
183
|
```
|
|
@@ -198,6 +210,7 @@ codex-workspaces restart
|
|
|
198
210
|
| `CODEX_QUIT_TIMEOUT` | `20` | Seconds to wait for app exit. |
|
|
199
211
|
| `CODEX_WORKSPACES_LINK` | `$HOME/.codex` | Active workspace link path. |
|
|
200
212
|
| `CODEX_WORKSPACES_ROOT` | `$HOME/.codex-workspaces` | Managed root for workspaces, accounts, backups, and lock file. |
|
|
213
|
+
| `CODEX_WORKSPACES_RESTORE_POLICY` | `workspace-default` | Account restore policy when entering a workspace: `workspace-default`, `last-active`, or `keep-current`. |
|
|
201
214
|
| `CODEX_WORKSPACES_LANG` | auto | Force output language with `en` or `zh`. |
|
|
202
215
|
|
|
203
216
|
Only the `CODEX_WORKSPACES_*` variables are used for workspace-specific configuration.
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
- 管理 `~/.codex-workspaces/accounts/` 下的账号快照。
|
|
18
18
|
- 切换当前 `~/.codex` 软链接或目录链接。
|
|
19
19
|
- 初始化带元数据的工作区目录。
|
|
20
|
+
- 通过隔离的临时登录工作区执行 `accounts add --login`,新增账号而不退出当前账号。
|
|
20
21
|
- 通过 `accounts use` 临时切换当前工作区账号,并可恢复工作区默认账号。
|
|
22
|
+
- 查看工作区/账号元数据,并通过 `doctor` 做账号诊断。
|
|
21
23
|
- 迁移旧版 `~/.codex-<name>` 工作区,并导入旧 `~/.codex-accounts` 账号快照。
|
|
22
24
|
- 保留 macOS 上 Codex App 的 `stop`、`start`、`restart`。
|
|
23
25
|
- 以只读方式读取 Codex `state_*.sqlite`,展示本地 token 用量统计。
|
|
@@ -121,6 +123,14 @@ codex-workspaces accounts init research
|
|
|
121
123
|
codex-workspaces accounts save research
|
|
122
124
|
```
|
|
123
125
|
|
|
126
|
+
如果要新增账号,但不想退出当前工作区账号,可以用临时登录工作区:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
codex-workspaces accounts add research --login
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
它会把 `~/.codex` 临时切到 `login-<账号>` 工作区,让你登录新账号;登录生成 `auth.json` 后保存为 `acct_<账号>`,再恢复原工作区。如果登录中断,可用 `codex-workspaces accounts cleanup-login-temp` 清理残留临时工作区。
|
|
133
|
+
|
|
124
134
|
导入旧 `codex-accounts` 的 AUTH 模式账号快照:
|
|
125
135
|
|
|
126
136
|
```bash
|
|
@@ -146,6 +156,7 @@ codex-workspaces work --no-stop --no-start
|
|
|
146
156
|
```bash
|
|
147
157
|
codex-workspaces list
|
|
148
158
|
codex-workspaces current
|
|
159
|
+
codex-workspaces info work
|
|
149
160
|
codex-workspaces doctor
|
|
150
161
|
codex-workspaces stats
|
|
151
162
|
codex-workspaces stats work --days 14
|
|
@@ -158,7 +169,7 @@ codex-workspaces accounts use acct_personal
|
|
|
158
169
|
codex-workspaces accounts restore-default
|
|
159
170
|
```
|
|
160
171
|
|
|
161
|
-
`accounts use` 只修改当前工作区的 `active_account_id`,不会修改 `default_account_id
|
|
172
|
+
`accounts use` 只修改当前工作区的 `active_account_id`,不会修改 `default_account_id`。进入工作区时按 `CODEX_WORKSPACES_RESTORE_POLICY` 恢复账号:`workspace-default` 恢复工作区默认账号,`last-active` 恢复该工作区上次活跃账号,`keep-current` 尽量沿用刚才正在使用的账号。
|
|
162
173
|
|
|
163
174
|
`auth.json` 包含认证凭据,不要提交到 git。工作区目录、账号快照、SQLite 状态、sessions 和 shell snapshots 已在本项目 `.gitignore` 中排除。
|
|
164
175
|
|
|
@@ -166,6 +177,7 @@ codex-workspaces accounts restore-default
|
|
|
166
177
|
|
|
167
178
|
```bash
|
|
168
179
|
codex-workspaces accounts note acct_research "实验室账号"
|
|
180
|
+
codex-workspaces accounts info acct_research
|
|
169
181
|
codex-workspaces accounts rename acct_research acct_lab
|
|
170
182
|
codex-workspaces accounts delete acct_lab --force
|
|
171
183
|
```
|
|
@@ -198,6 +210,7 @@ codex-workspaces restart
|
|
|
198
210
|
| `CODEX_QUIT_TIMEOUT` | `20` | 等待 App 退出的秒数。 |
|
|
199
211
|
| `CODEX_WORKSPACES_LINK` | `$HOME/.codex` | 当前工作区链接路径。 |
|
|
200
212
|
| `CODEX_WORKSPACES_ROOT` | `$HOME/.codex-workspaces` | workspaces、accounts、backups 和 lock 所在管理根目录。 |
|
|
213
|
+
| `CODEX_WORKSPACES_RESTORE_POLICY` | `workspace-default` | 进入工作区时的账号恢复策略:`workspace-default`、`last-active` 或 `keep-current`。 |
|
|
201
214
|
| `CODEX_WORKSPACES_LANG` | 自动 | 强制输出语言,可设为 `en` 或 `zh`。 |
|
|
202
215
|
|
|
203
216
|
工作区相关配置只使用 `CODEX_WORKSPACES_*` 变量。
|
|
@@ -80,10 +80,11 @@ Windows:
|
|
|
80
80
|
## 安全设计
|
|
81
81
|
|
|
82
82
|
- 如果 `~/.codex` 存在且不是链接,`switch` 拒绝执行,避免覆盖真实目录。
|
|
83
|
-
- 旧 `~/.codex-<name>` 工作区迁移和旧 `~/.codex-accounts`
|
|
83
|
+
- 旧 `~/.codex-<name>` 工作区迁移和旧 `~/.codex-accounts` 导入已支持。
|
|
84
|
+
- `accounts add <account> --login` 使用临时 `login-<account>` 工作区登录新账号,保存账号快照后恢复原工作区。
|
|
84
85
|
- 切换 workspace 前会保存当前 live `auth.json` 到 `active_account_id` 对应账号快照。
|
|
85
86
|
- `accounts use` 只修改当前 workspace 的 `active_account_id`,不修改 `default_account_id`。
|
|
86
|
-
- 进入 workspace
|
|
87
|
+
- 进入 workspace 时按策略恢复账号:`workspace-default` 恢复默认账号,`last-active` 恢复该 workspace 上次活跃账号,`keep-current` 尽量沿用刚才正在使用的账号。
|
|
87
88
|
- `migrate --dry-run` 只打印计划,不创建目录、不写元数据。
|
|
88
89
|
- `migrate` 会先备份当前 `~/.codex`、旧 workspace 和旧账号目录,再复制到统一目录;旧目录不会被自动删除。
|
|
89
90
|
- 如果当前 `~/.codex` 是真实目录,批量 `migrate` 会拒绝覆盖;应使用 `init <name> --migrate-current` 显式迁移当前目录。
|
|
@@ -97,13 +98,18 @@ Windows:
|
|
|
97
98
|
|
|
98
99
|
工作区相关环境变量:
|
|
99
100
|
|
|
100
|
-
- 变量:`CODEX_WORKSPACES_ROOT`、`CODEX_WORKSPACES_LINK`、`CODEX_WORKSPACES_WORKSPACES_DIR`、`CODEX_WORKSPACES_ACCOUNTS_DIR`、`CODEX_WORKSPACES_LANG`。
|
|
101
|
+
- 变量:`CODEX_WORKSPACES_ROOT`、`CODEX_WORKSPACES_LINK`、`CODEX_WORKSPACES_WORKSPACES_DIR`、`CODEX_WORKSPACES_ACCOUNTS_DIR`、`CODEX_WORKSPACES_RESTORE_POLICY`、`CODEX_WORKSPACES_LANG`。
|
|
102
|
+
- `CODEX_WORKSPACES_RESTORE_POLICY` 可选 `workspace-default`、`last-active`、`keep-current`;无效值回退到 `workspace-default`。
|
|
101
103
|
|
|
102
104
|
迁移相关命令:
|
|
103
105
|
|
|
104
106
|
- `codex-workspaces migrate --dry-run`
|
|
105
107
|
- `codex-workspaces migrate [--from-prefix ~/.codex-] [--from-accounts ~/.codex-accounts]`
|
|
106
108
|
- `codex-workspaces init <workspace> --migrate-current`
|
|
109
|
+
- `codex-workspaces info <workspace>`
|
|
110
|
+
- `codex-workspaces accounts add <account> --login`
|
|
111
|
+
- `codex-workspaces accounts login-temp <account>`
|
|
112
|
+
- `codex-workspaces accounts cleanup-login-temp`
|
|
107
113
|
- `codex-workspaces accounts import-workspaces`
|
|
108
114
|
- `codex-workspaces accounts import-legacy <legacy_accounts_dir>`
|
|
109
115
|
|
|
@@ -88,9 +88,9 @@ permissions:
|
|
|
88
88
|
1. 更新版本号和 `CHANGELOG.md`。
|
|
89
89
|
2. 本地执行测试和构建检查。
|
|
90
90
|
3. 合并到 `main`。
|
|
91
|
-
4. 创建 Git tag,例如 `v0.3.
|
|
91
|
+
4. 创建 Git tag,例如 `v0.3.1`,触发 `Publish to TestPyPI`。
|
|
92
92
|
5. 确认 TestPyPI 上传和安装正常。
|
|
93
|
-
6. 从同一个提交创建并推送正式发布分支,例如 `release/v0.3.
|
|
93
|
+
6. 从同一个提交创建并推送正式发布分支,例如 `release/v0.3.1`,触发 `Publish to PyPI`。
|
|
94
94
|
7. 如果 `pypi` Environment 配置了 Required reviewers,在 GitHub Actions 里批准部署。
|
|
95
95
|
8. 在 PyPI 页面确认 wheel、sdist 和 README 渲染正常。
|
|
96
96
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
- 文件系统行为:初始化统一目录工作区、切换链接、拒绝覆盖真实目录。
|
|
8
8
|
- CLI 行为:命令别名、工作区名快捷切换、错误路径、帮助输出。
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- 管理行为:诊断、列表元信息、工作区详情、重命名、删除保护、备注读写和账号绑定。
|
|
10
|
+
- 账号行为:账号快照保存、列表/详情增强、备注、重命名、删除保护、临时切换、login-temp 新增账号、默认账号恢复、默认账号设置。
|
|
11
11
|
- 迁移行为:旧 `~/.codex-<name>` 工作区迁移、旧 `~/.codex-accounts` 导入、dry-run 不落盘、迁移前备份。
|
|
12
12
|
- 统计行为:只读 `state_*.sqlite`,汇总 token、模型、最近会话和每日用量。
|
|
13
13
|
- 平台行为:macOS App 控制可注入,非 macOS 自动跳过 App 启停,Codex 内置 Terminal 阻止或转交危险操作。
|
|
@@ -67,6 +67,10 @@ CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
|
67
67
|
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
68
68
|
codex-workspaces current
|
|
69
69
|
|
|
70
|
+
CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
71
|
+
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
72
|
+
codex-workspaces info personal
|
|
73
|
+
|
|
70
74
|
CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
71
75
|
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
72
76
|
codex-workspaces doctor
|
|
@@ -90,6 +94,15 @@ CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
|
90
94
|
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
91
95
|
codex-workspaces accounts list
|
|
92
96
|
|
|
97
|
+
CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
98
|
+
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
99
|
+
codex-workspaces accounts info personal
|
|
100
|
+
|
|
101
|
+
# 新账号登录流程会切到临时 login-research 工作区,登录完成后恢复原工作区。
|
|
102
|
+
# CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
103
|
+
# CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
104
|
+
# codex-workspaces accounts add research --login
|
|
105
|
+
|
|
93
106
|
CODEX_WORKSPACES_LINK="$tmp_home/.codex" \
|
|
94
107
|
CODEX_WORKSPACES_ROOT="$tmp_home/.codex-workspaces" \
|
|
95
108
|
codex-workspaces note personal "primary workspace"
|
|
@@ -128,6 +141,7 @@ HOME="$tmp_home" codex-workspaces accounts list
|
|
|
128
141
|
- `~/.codex` 指向新的 `workspaces/work`。
|
|
129
142
|
- `~/.codex-work` 和 `~/.codex-accounts` 仍保留。
|
|
130
143
|
- `~/.codex-workspaces/backups/<timestamp>/before-migrate/` 下有迁移前备份。
|
|
144
|
+
- `migrate` 最后输出迁移报告,包含 migrated/skipped/renamed-conflict/special-file-skipped 摘要。
|
|
131
145
|
|
|
132
146
|
macOS 上再额外验证:
|
|
133
147
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codex-workspaces"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "Cross-platform Codex workspace switcher with a preserved macOS shell workflow."
|
|
9
9
|
readme = "README.MD"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -27,6 +27,14 @@ def run(argv: Sequence[str], manager: WorkspaceManager) -> int:
|
|
|
27
27
|
if command in {"current", "whoami"}:
|
|
28
28
|
manager.show_current()
|
|
29
29
|
return 0
|
|
30
|
+
if command == "info":
|
|
31
|
+
if len(args) != 1:
|
|
32
|
+
manager.fail(
|
|
33
|
+
"用法: codex-workspaces info <工作区名>",
|
|
34
|
+
"Usage: codex-workspaces info <workspace>",
|
|
35
|
+
)
|
|
36
|
+
manager.workspace_info(args[0])
|
|
37
|
+
return 0
|
|
30
38
|
if command in {"doctor", "diagnose"}:
|
|
31
39
|
manager.doctor()
|
|
32
40
|
return 0
|
|
@@ -200,6 +208,25 @@ def run_accounts(args: Sequence[str], manager: WorkspaceManager) -> int:
|
|
|
200
208
|
)
|
|
201
209
|
manager.accounts_save(rest[0])
|
|
202
210
|
return 0
|
|
211
|
+
if command == "add":
|
|
212
|
+
if not rest:
|
|
213
|
+
manager.fail(
|
|
214
|
+
"用法: codex-workspaces accounts add <账号> --login",
|
|
215
|
+
"Usage: codex-workspaces accounts add <account> --login",
|
|
216
|
+
)
|
|
217
|
+
manager.accounts_add(rest[0], rest[1:])
|
|
218
|
+
return 0
|
|
219
|
+
if command == "login-temp":
|
|
220
|
+
if not rest:
|
|
221
|
+
manager.fail(
|
|
222
|
+
"用法: codex-workspaces accounts login-temp <账号>",
|
|
223
|
+
"Usage: codex-workspaces accounts login-temp <account>",
|
|
224
|
+
)
|
|
225
|
+
manager.accounts_add(rest[0], ["--login", *rest[1:]])
|
|
226
|
+
return 0
|
|
227
|
+
if command == "cleanup-login-temp":
|
|
228
|
+
manager.accounts_cleanup_login_temp(rest)
|
|
229
|
+
return 0
|
|
203
230
|
if command == "use":
|
|
204
231
|
if len(rest) != 1:
|
|
205
232
|
manager.fail(
|
|
@@ -268,11 +295,6 @@ def run_accounts(args: Sequence[str], manager: WorkspaceManager) -> int:
|
|
|
268
295
|
)
|
|
269
296
|
manager.accounts_import_legacy(rest[0])
|
|
270
297
|
return 0
|
|
271
|
-
if command in {"add", "cleanup-login-temp"}:
|
|
272
|
-
manager.fail(
|
|
273
|
-
f"accounts {command} 依赖 login-temp 登录流程,仍留到后续阶段。",
|
|
274
|
-
f"accounts {command} depends on the login-temp flow and is still deferred to a later phase.",
|
|
275
|
-
)
|
|
276
298
|
manager.fail(f"未知 accounts 命令: {command}", f"Unknown accounts command: {command}")
|
|
277
299
|
return 1
|
|
278
300
|
|
|
@@ -6,6 +6,9 @@ from pathlib import Path
|
|
|
6
6
|
from typing import Mapping, Optional
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
RESTORE_POLICIES = {"workspace-default", "last-active", "keep-current"}
|
|
10
|
+
|
|
11
|
+
|
|
9
12
|
def _looks_zh(value: str) -> bool:
|
|
10
13
|
return value.lower().replace("_", "-").startswith("zh")
|
|
11
14
|
|
|
@@ -50,6 +53,7 @@ class Config:
|
|
|
50
53
|
workspace_prefix: str
|
|
51
54
|
quit_timeout: int
|
|
52
55
|
lang: str
|
|
56
|
+
restore_policy: str = "workspace-default"
|
|
53
57
|
|
|
54
58
|
@classmethod
|
|
55
59
|
def from_env(
|
|
@@ -86,6 +90,9 @@ class Config:
|
|
|
86
90
|
lock_file = root_dir / "lock"
|
|
87
91
|
workspace_prefix = str(workspaces_dir) + os.sep
|
|
88
92
|
quit_timeout = int(env.get("CODEX_QUIT_TIMEOUT") or "20")
|
|
93
|
+
restore_policy = env.get("CODEX_WORKSPACES_RESTORE_POLICY") or "workspace-default"
|
|
94
|
+
if restore_policy not in RESTORE_POLICIES:
|
|
95
|
+
restore_policy = "workspace-default"
|
|
89
96
|
|
|
90
97
|
return cls(
|
|
91
98
|
app_name=env.get("CODEX_APP_NAME") or "Codex",
|
|
@@ -99,4 +106,5 @@ class Config:
|
|
|
99
106
|
workspace_prefix=workspace_prefix,
|
|
100
107
|
quit_timeout=quit_timeout,
|
|
101
108
|
lang=detect_ui_lang(env, apple_language),
|
|
109
|
+
restore_policy=restore_policy,
|
|
102
110
|
)
|