@minniexcode/codex-switch 0.0.6 → 0.0.7
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/README.AI.md +5 -2
- package/README.md +12 -6
- package/dist/app/add-provider.js +21 -3
- package/dist/app/edit-provider.js +39 -11
- package/dist/app/get-status.js +8 -1
- package/dist/app/init-codex.js +68 -0
- package/dist/app/list-providers.js +1 -0
- package/dist/app/run-doctor.js +60 -0
- package/dist/app/setup-codex.js +17 -8
- package/dist/app/show-config.js +9 -1
- package/dist/app/switch-provider.js +14 -7
- package/dist/cli/add-interactive.js +4 -2
- package/dist/cli/args.js +3 -0
- package/dist/cli/help.js +3 -0
- package/dist/cli/interactive.js +3 -0
- package/dist/cli/output.js +20 -5
- package/dist/cli/prompt.js +3 -0
- package/dist/cli.js +1 -1
- package/dist/commands/handlers.js +80 -11
- package/dist/commands/help.js +2 -1
- package/dist/commands/registry.js +73 -13
- package/dist/domain/config.js +137 -0
- package/dist/domain/providers.js +16 -2
- package/dist/domain/setup.js +1 -0
- package/dist/infra/backup-repo.js +3 -0
- package/dist/infra/codex-cli.js +3 -0
- package/dist/infra/codex-paths.js +3 -0
- package/dist/infra/fs-utils.js +3 -0
- package/dist/infra/lock-repo.js +3 -0
- package/dist/infra/providers-repo.js +3 -0
- package/dist/interaction/add-interactive.js +9 -18
- package/dist/interaction/interactive.js +84 -11
- package/dist/runtime/codex-probe.js +7 -0
- package/dist/storage/auth-repo.js +160 -0
- package/dist/storage/config-repo.js +58 -0
- package/docs/Design/codex-switch-v0.0.7-design.md +862 -0
- package/docs/PRD/codex-switch-prd-v0.0.5-to-v0.1.0.md +131 -25
- package/docs/Reference/codex-config-reference.md +604 -0
- package/docs/Reference/codex-config-reference.zh-CN.md +633 -0
- package/docs/cli-usage.md +77 -29
- package/docs/test-report-0.0.7.md +118 -0
- package/docs/testing.md +67 -47
- package/package.json +1 -1
package/docs/cli-usage.md
CHANGED
|
@@ -89,7 +89,7 @@ CLI 的交互行为遵循以下规则:
|
|
|
89
89
|
|
|
90
90
|
典型受影响命令包括:
|
|
91
91
|
|
|
92
|
-
- `
|
|
92
|
+
- `migrate`
|
|
93
93
|
- `add`
|
|
94
94
|
- `edit`
|
|
95
95
|
- `switch`
|
|
@@ -207,41 +207,89 @@ codexs backups list --json
|
|
|
207
207
|
|
|
208
208
|
## 5. 变更类命令
|
|
209
209
|
|
|
210
|
-
### 5.1 `
|
|
210
|
+
### 5.1 `init`
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
轻量初始化目标 Codex 目录,确保 `providers.json` 已存在。
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
|
-
codexs
|
|
215
|
+
codexs init [--json] [--codex-dir <path>]
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
示例:
|
|
219
219
|
|
|
220
220
|
```bash
|
|
221
|
-
codexs
|
|
222
|
-
codexs
|
|
223
|
-
codexs
|
|
221
|
+
codexs init
|
|
222
|
+
codexs init --json
|
|
223
|
+
codexs init --codex-dir ./.tmp-codex
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
行为说明:
|
|
227
|
+
|
|
228
|
+
- 不依赖 `codex` 可执行文件
|
|
229
|
+
- 不要求 `config.toml` 或 `auth.json` 已存在
|
|
230
|
+
- `providers.json` 不存在时创建空 registry:`{ "providers": {} }`
|
|
231
|
+
- `providers.json` 已存在时返回成功 no-op,不改写文件,也不会创建备份
|
|
232
|
+
- 成功 JSON 结果固定包含:`codexDir`、`createdCodexDir`、`createdProvidersFile`、`providersAlreadyExisted`、`configExists`、`authExists`
|
|
233
|
+
|
|
234
|
+
交互模式:
|
|
235
|
+
|
|
236
|
+
- 未显式传 `--codex-dir` 时,会复用候选目录发现并允许你选择或手动输入目录
|
|
237
|
+
- 如果目标目录不存在,会确认是否创建目录
|
|
238
|
+
|
|
239
|
+
非交互模式:
|
|
240
|
+
|
|
241
|
+
- `--json` 或非 TTY 下绝不会进入 prompt
|
|
242
|
+
- 目标目录不存在时直接返回结构化错误
|
|
243
|
+
|
|
244
|
+
### 5.2 `migrate`
|
|
245
|
+
|
|
246
|
+
从现有 `config.toml` adopt unmanaged profiles,并写入受管理的 `providers.json`。
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
codexs migrate [--json] [--codex-dir <path>] [--merge|--overwrite]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
示例:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
codexs migrate
|
|
256
|
+
codexs migrate --overwrite --json
|
|
257
|
+
codexs migrate --merge --codex-dir ./.tmp-codex
|
|
224
258
|
```
|
|
225
259
|
|
|
226
260
|
行为说明:
|
|
227
261
|
|
|
228
262
|
- 读取 `config.toml` 中已有 profile
|
|
229
|
-
- 仅 adopt 已具备 `model`、`model_provider` 且能解析到匹配 `model_providers.*.base_url` 的 profile
|
|
263
|
+
- 仅 adopt 已具备 `model`、`model_provider` 且能解析到匹配 `model_providers.*.base_url` 和 `env_key` 的 unmanaged profile
|
|
230
264
|
- 收集每个 profile 对应的 provider 记录
|
|
231
|
-
-
|
|
232
|
-
- 成功后会自动运行一次 `doctor`
|
|
265
|
+
- 保持现有受管备份、锁、`auth.json` mirror 和 post-run `doctor` 流程
|
|
233
266
|
|
|
234
267
|
交互模式:
|
|
235
268
|
|
|
236
269
|
- 如果 `providers.json` 已存在,会让你选择 `merge`、`overwrite` 或取消
|
|
237
|
-
-
|
|
270
|
+
- profile 选择和 provider 细节收集仍然只在 TTY 中进行
|
|
238
271
|
|
|
239
272
|
非交互模式:
|
|
240
273
|
|
|
241
274
|
- `providers.json` 已存在时,必须显式传入 `--merge` 或 `--overwrite`
|
|
242
275
|
- `--json` 模式下不会进入任何引导式输入
|
|
276
|
+
- 由于 adopt profile 选择和 provider secret 收集仍然是交互契约,当前版本会直接失败
|
|
277
|
+
|
|
278
|
+
### 5.3 `setup`
|
|
279
|
+
|
|
280
|
+
`setup` 已弃用,不再执行实际初始化或迁移工作。
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
codexs setup
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
行为说明:
|
|
243
287
|
|
|
244
|
-
|
|
288
|
+
- 该命令现在返回 `COMMAND_DEPRECATED`
|
|
289
|
+
- 错误详情中包含 `replacements: ["init", "migrate"]`
|
|
290
|
+
- 应改用 `codexs init` 或 `codexs migrate`
|
|
291
|
+
|
|
292
|
+
### 5.4 `add`
|
|
245
293
|
|
|
246
294
|
新增一个 provider。
|
|
247
295
|
|
|
@@ -272,13 +320,13 @@ codexs add
|
|
|
272
320
|
- 如果缺少 `provider`、`profile`、`apiKey`,会在 TTY 中补问
|
|
273
321
|
- profile 选择会优先复用现有 `config.toml` profile
|
|
274
322
|
- API key 的隐藏输入会做二次确认
|
|
275
|
-
- tag
|
|
323
|
+
- tag 仅支持预设选项多选
|
|
276
324
|
|
|
277
325
|
非交互模式:
|
|
278
326
|
|
|
279
327
|
- 必须显式传入所有必填字段
|
|
280
328
|
|
|
281
|
-
### 5.
|
|
329
|
+
### 5.5 `edit`
|
|
282
330
|
|
|
283
331
|
编辑单个 provider 的字段。
|
|
284
332
|
|
|
@@ -309,39 +357,35 @@ codexs edit packycode --tag daily --tag paid
|
|
|
309
357
|
|
|
310
358
|
- 至少要提供一个需要修改的字段
|
|
311
359
|
|
|
312
|
-
### 5.
|
|
360
|
+
### 5.6 `switch`
|
|
313
361
|
|
|
314
362
|
切换当前使用的 provider/profile。
|
|
315
363
|
|
|
316
364
|
```bash
|
|
317
|
-
codexs switch <provider> [--
|
|
365
|
+
codexs switch <provider> [--json] [--codex-dir <path>]
|
|
318
366
|
```
|
|
319
367
|
|
|
320
368
|
示例:
|
|
321
369
|
|
|
322
370
|
```bash
|
|
323
371
|
codexs switch freemodel
|
|
324
|
-
codexs switch freemodel --
|
|
325
|
-
codexs switch
|
|
372
|
+
codexs switch freemodel --json
|
|
373
|
+
codexs switch
|
|
326
374
|
```
|
|
327
375
|
|
|
328
376
|
行为说明:
|
|
329
377
|
|
|
330
378
|
- 根据 `providers.json` 找到目标 provider
|
|
331
379
|
- 更新相关运行态配置
|
|
332
|
-
-
|
|
380
|
+
- 重写当前 active provider 对应的 `auth.json` mirror
|
|
333
381
|
- 会先备份 `config.toml` 和 `auth.json`
|
|
334
382
|
|
|
335
|
-
参数说明:
|
|
336
|
-
|
|
337
|
-
- `--no-login`:切换后不执行登录刷新
|
|
338
|
-
|
|
339
383
|
交互模式:
|
|
340
384
|
|
|
341
385
|
- 如果没有传 `<provider>`,TTY 下会弹出 provider 选择器
|
|
342
386
|
- 如果已经传了 `<provider>`,则直接执行,不再额外确认
|
|
343
387
|
|
|
344
|
-
### 5.
|
|
388
|
+
### 5.7 `remove`
|
|
345
389
|
|
|
346
390
|
删除一个 provider 记录。
|
|
347
391
|
|
|
@@ -370,7 +414,7 @@ codexs remove freemodel --force --json
|
|
|
370
414
|
|
|
371
415
|
- 必须同时传入 `<provider>` 和 `--force`
|
|
372
416
|
|
|
373
|
-
### 5.
|
|
417
|
+
### 5.8 `import`
|
|
374
418
|
|
|
375
419
|
从外部 JSON 文件导入 provider 配置。
|
|
376
420
|
|
|
@@ -401,7 +445,7 @@ codexs import ./providers.json --merge --json
|
|
|
401
445
|
- 不会弹出路径向导或确认框
|
|
402
446
|
- 会先验证输入文件,再执行写入
|
|
403
447
|
|
|
404
|
-
### 5.
|
|
448
|
+
### 5.9 `export`
|
|
405
449
|
|
|
406
450
|
导出当前 `providers.json` 到指定文件。
|
|
407
451
|
|
|
@@ -499,7 +543,7 @@ codexs <command> --json
|
|
|
499
543
|
```bash
|
|
500
544
|
codexs list --json
|
|
501
545
|
codexs show packycode --json
|
|
502
|
-
codexs switch packycode --
|
|
546
|
+
codexs switch packycode --json
|
|
503
547
|
codexs export ./providers.snapshot.json --force --json
|
|
504
548
|
codexs rollback 20260511-221457-switch --json
|
|
505
549
|
```
|
|
@@ -509,7 +553,8 @@ codexs rollback 20260511-221457-switch --json
|
|
|
509
553
|
### 8.1 第一次接管现有 Codex 配置
|
|
510
554
|
|
|
511
555
|
```bash
|
|
512
|
-
codexs
|
|
556
|
+
codexs init
|
|
557
|
+
codexs migrate
|
|
513
558
|
codexs list
|
|
514
559
|
codexs doctor
|
|
515
560
|
```
|
|
@@ -547,7 +592,8 @@ codexs rollback <backup-id>
|
|
|
547
592
|
|
|
548
593
|
以下命令会修改本地配置或覆盖文件,使用前应明确预期:
|
|
549
594
|
|
|
550
|
-
- `
|
|
595
|
+
- `init`
|
|
596
|
+
- `migrate`
|
|
551
597
|
- `add`
|
|
552
598
|
- `edit`
|
|
553
599
|
- `switch`
|
|
@@ -573,6 +619,8 @@ codexs --help
|
|
|
573
619
|
也可以查看单个命令帮助:
|
|
574
620
|
|
|
575
621
|
```bash
|
|
622
|
+
codexs help init
|
|
623
|
+
codexs help migrate
|
|
576
624
|
codexs help setup
|
|
577
625
|
codexs help add
|
|
578
626
|
codexs help switch
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Test Report: 0.0.7
|
|
2
|
+
|
|
3
|
+
Date: 2026-05-14
|
|
4
|
+
|
|
5
|
+
## Environment
|
|
6
|
+
|
|
7
|
+
- Platform: Windows (`win32`)
|
|
8
|
+
- Workspace: `C:\Users\A200477427\Developers\Github\codex-switch`
|
|
9
|
+
- Node.js: `v24.11.1`
|
|
10
|
+
- npm: `11.13.0`
|
|
11
|
+
|
|
12
|
+
## Scope
|
|
13
|
+
|
|
14
|
+
This report covers the current automated suite plus the new built-CLI entrypoint checks added in `tests/cli-e2e.spec.js`.
|
|
15
|
+
|
|
16
|
+
Chinese summary:
|
|
17
|
+
|
|
18
|
+
- `npm test` is not compile-only. It rebuilds `dist/` and then runs the full automated suite.
|
|
19
|
+
- `add` now has explicit built-CLI non-interactive regression coverage.
|
|
20
|
+
- `migrate` is verified in two ways: built CLI non-interactive failure contract, plus injected interactive workflow coverage.
|
|
21
|
+
- `setup` is verified as deprecated and must fail with `COMMAND_DEPRECATED`.
|
|
22
|
+
|
|
23
|
+
## Commands Run
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx tsc --noEmit
|
|
27
|
+
npm test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Overall Result
|
|
31
|
+
|
|
32
|
+
- TypeScript check: PASS
|
|
33
|
+
- Build and suites: PASS
|
|
34
|
+
- Full suite total: `39 passed, 0 failed`
|
|
35
|
+
|
|
36
|
+
Suite results:
|
|
37
|
+
|
|
38
|
+
- `commands`: PASS (`10/10`)
|
|
39
|
+
- `cli-e2e`: PASS (`7/7`)
|
|
40
|
+
- `interaction`: PASS (`8/8`)
|
|
41
|
+
- `runtime`: PASS (`2/2`)
|
|
42
|
+
- `workflows`: PASS (`12/12`)
|
|
43
|
+
|
|
44
|
+
## Built CLI Command Matrix
|
|
45
|
+
|
|
46
|
+
Read commands covered through the built CLI entrypoint:
|
|
47
|
+
|
|
48
|
+
- `--help`
|
|
49
|
+
- `--version`
|
|
50
|
+
- `list --json`
|
|
51
|
+
- `show --json`
|
|
52
|
+
- `current --json`
|
|
53
|
+
- `status --json`
|
|
54
|
+
- `config show --json`
|
|
55
|
+
- `config list-profiles --json`
|
|
56
|
+
- `backups list --json`
|
|
57
|
+
- `doctor --json`
|
|
58
|
+
|
|
59
|
+
Write commands covered through the built CLI entrypoint on temp copies:
|
|
60
|
+
|
|
61
|
+
- `init --json`
|
|
62
|
+
- `add --json`
|
|
63
|
+
- `add --create-profile --json`
|
|
64
|
+
- `edit --json`
|
|
65
|
+
- `switch --json`
|
|
66
|
+
- `remove --force --json`
|
|
67
|
+
- `import --json`
|
|
68
|
+
- `export --force --json`
|
|
69
|
+
- `rollback --json`
|
|
70
|
+
|
|
71
|
+
Negative contract checks through the built CLI entrypoint:
|
|
72
|
+
|
|
73
|
+
- `add` against a missing profile without `--create-profile`
|
|
74
|
+
- removing the active provider profile
|
|
75
|
+
- `rollback <missing-id>`
|
|
76
|
+
- `migrate --overwrite --json`
|
|
77
|
+
- `setup --json`
|
|
78
|
+
|
|
79
|
+
## Key Findings
|
|
80
|
+
|
|
81
|
+
### 1. `npm test` behavior
|
|
82
|
+
|
|
83
|
+
`npm test` rebuilds the project first and then executes the JavaScript test harness in `tests/run-tests.js`. It is not a compile-only command.
|
|
84
|
+
|
|
85
|
+
### 2. `add`
|
|
86
|
+
|
|
87
|
+
Validated behaviors:
|
|
88
|
+
|
|
89
|
+
- succeeds non-interactively when all required flags are provided
|
|
90
|
+
- creates `providers.json` entries with derived `envKey`
|
|
91
|
+
- supports `--create-profile` to add missing profile and model provider sections
|
|
92
|
+
- fails with `PROFILE_NOT_FOUND` when targeting a missing profile without `--create-profile`
|
|
93
|
+
|
|
94
|
+
### 3. `migrate`
|
|
95
|
+
|
|
96
|
+
Validated behaviors:
|
|
97
|
+
|
|
98
|
+
- built CLI non-interactive path currently fails by design with `INVALID_ARGUMENT`
|
|
99
|
+
- error payload includes adoptable profile metadata and a suggestion to run in an interactive TTY
|
|
100
|
+
- interactive adopt flow remains covered in `tests/workflows.spec.js` through runtime injection
|
|
101
|
+
|
|
102
|
+
This means the current implementation does not support a full non-interactive `migrate` workflow yet. The new tests lock that behavior in as an explicit contract instead of silently leaving it unverified.
|
|
103
|
+
|
|
104
|
+
### 4. Repository sandbox observations
|
|
105
|
+
|
|
106
|
+
Observed from the checked-in `dev-codex/local-sandbox` fixture during this run:
|
|
107
|
+
|
|
108
|
+
- active profile: `freemodel`
|
|
109
|
+
- managed providers in `list --json`: `alpha`, `bestmodel`, `beta`, `freemodel`
|
|
110
|
+
- `doctor --json` returns `healthy: false` in this automation environment because runtime probing reports `CODEX_NOT_INSTALLED`
|
|
111
|
+
- the `doctor` issue is environmental, not a providers/config parse failure
|
|
112
|
+
|
|
113
|
+
## Residual Risks
|
|
114
|
+
|
|
115
|
+
- prompt-driven subprocess automation for true interactive `migrate` is still not covered end-to-end
|
|
116
|
+
- Windows sandbox restrictions currently block nested `child_process` launches with `EPERM`, so automated command checks run through the built CLI entrypoint in-process instead of spawning `node dist/cli.js`
|
|
117
|
+
- `rollback-latest` still lacks a dedicated direct test
|
|
118
|
+
- backup corruption coverage is still focused on selected cases rather than an exhaustive matrix
|
package/docs/testing.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Testing Guide
|
|
2
2
|
|
|
3
|
-
`codex-switch`
|
|
3
|
+
`codex-switch` currently ships with five active test layers:
|
|
4
4
|
|
|
5
|
-
- `tests/
|
|
6
|
-
- `tests/
|
|
7
|
-
- `tests/
|
|
8
|
-
- `tests/
|
|
9
|
-
- `tests/
|
|
5
|
+
- `tests/commands.spec.js`: argument parsing, help rendering, and command dispatch contracts
|
|
6
|
+
- `tests/cli-e2e.spec.js`: built CLI entrypoint checks for user-visible command behavior and rendered output
|
|
7
|
+
- `tests/interaction.spec.js`: prompt boundary and interactive data collection behavior
|
|
8
|
+
- `tests/runtime.spec.js`: Codex runtime probing and version checks
|
|
9
|
+
- `tests/workflows.spec.js`: file-backed app workflow coverage for write operations and rollback paths
|
|
10
10
|
|
|
11
11
|
## Commands
|
|
12
12
|
|
|
@@ -22,11 +22,18 @@ Run the full suite:
|
|
|
22
22
|
npm test
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`npm test` is not compile-only. It runs:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
|
|
29
|
-
node -
|
|
28
|
+
npm run build
|
|
29
|
+
node tests/run-tests.js
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run one suite manually:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
node -e "require('./tests/cli-e2e.spec').tests[0].run()"
|
|
36
|
+
node -e "require('./tests/workflows.spec').tests[0].run()"
|
|
30
37
|
```
|
|
31
38
|
|
|
32
39
|
## Development Fixture
|
|
@@ -39,61 +46,74 @@ dev-codex/local-sandbox/
|
|
|
39
46
|
|
|
40
47
|
It is used in two different ways:
|
|
41
48
|
|
|
42
|
-
- read-
|
|
43
|
-
-
|
|
49
|
+
- read-oriented CLI subprocess tests point at it directly
|
|
50
|
+
- write-oriented tests copy it into a temporary directory before running mutations
|
|
44
51
|
|
|
45
52
|
Do not point destructive automation directly at `dev-codex/local-sandbox` unless you intentionally want to update the fixture.
|
|
46
53
|
|
|
47
|
-
##
|
|
54
|
+
## Built CLI Coverage
|
|
55
|
+
|
|
56
|
+
`tests/cli-e2e.spec.js` executes the built CLI entrypoint logic from `dist/` and asserts the same JSON and human-readable payloads users see.
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
Covered entrypoint checks:
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
- `--help`
|
|
61
|
+
- `--version`
|
|
62
|
+
|
|
63
|
+
Covered read commands against the repository sandbox:
|
|
52
64
|
|
|
53
65
|
- `list --json`
|
|
66
|
+
- `show --json`
|
|
54
67
|
- `current --json`
|
|
55
68
|
- `status --json`
|
|
56
69
|
- `config show --json`
|
|
70
|
+
- `config list-profiles --json`
|
|
57
71
|
- `backups list --json`
|
|
58
72
|
- `doctor --json`
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- development default resolution with `NODE_ENV=development`
|
|
63
|
-
- explicit `--codex-dir dev-codex/local-sandbox`
|
|
74
|
+
Covered write commands against temporary sandbox copies:
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
- `init --json`
|
|
77
|
+
- `add --json`
|
|
78
|
+
- `add --create-profile --json`
|
|
79
|
+
- `edit --json`
|
|
80
|
+
- `switch --json`
|
|
81
|
+
- `remove --force --json`
|
|
82
|
+
- `import --json`
|
|
83
|
+
- `export --force --json`
|
|
84
|
+
- `rollback --json`
|
|
85
|
+
- `setup --json`
|
|
66
86
|
|
|
67
|
-
|
|
87
|
+
Covered non-interactive failure contracts:
|
|
68
88
|
|
|
69
|
-
`
|
|
89
|
+
- `add` without an existing profile or `--create-profile`
|
|
90
|
+
- blocking destructive removal of the active provider profile
|
|
91
|
+
- `rollback <missing-id>`
|
|
92
|
+
- `migrate --overwrite --json`
|
|
93
|
+
- `setup --json`
|
|
70
94
|
|
|
71
|
-
|
|
95
|
+
This harness intentionally avoids `child_process` subprocess spawning because the current Windows sandbox used by automation blocks nested process launches with `EPERM`. The suite still validates the built CLI layer rather than calling app functions directly.
|
|
72
96
|
|
|
73
|
-
|
|
74
|
-
- `rollback` restoring `config.toml` and `auth.json`
|
|
75
|
-
- `add`, `edit`, `remove`
|
|
76
|
-
- `add --create-profile`
|
|
77
|
-
- blocking destructive remove of the active profile provider
|
|
78
|
-
- `import --merge`
|
|
79
|
-
- `export`
|
|
80
|
-
- `backups list` with corrupt backup entries
|
|
81
|
-
- `rollback <missing-id>`
|
|
82
|
-
- corrupt `backups/latest.json`
|
|
97
|
+
## Workflow Coverage
|
|
83
98
|
|
|
84
|
-
|
|
99
|
+
`tests/workflows.spec.js` keeps the deeper file-backed mutation coverage at the app/dispatch layer.
|
|
85
100
|
|
|
86
|
-
|
|
87
|
-
- `import --merge -> switch --no-login -> remove -> doctor -> backups list -> rollback <backup-id>`
|
|
101
|
+
Important workflow scenarios already covered there include:
|
|
88
102
|
|
|
89
|
-
|
|
103
|
+
- non-interactive `init`
|
|
104
|
+
- non-interactive `migrate` failure behavior
|
|
105
|
+
- interactive `migrate` adoption via injected runtime
|
|
106
|
+
- `add`, `edit`, `remove`
|
|
107
|
+
- `switch` plus rollback
|
|
108
|
+
- `export` and `import`
|
|
109
|
+
- auth write rollback on failure
|
|
90
110
|
|
|
91
111
|
## Fixture Rules
|
|
92
112
|
|
|
93
113
|
- Prefer `--codex-dir <temp-copy>` for all write tests.
|
|
94
114
|
- Prefer `--json` when assertions need stable output.
|
|
95
115
|
- Treat `show --json` output as sensitive because it includes unmasked API keys.
|
|
96
|
-
- If a test needs `codex login` or `codex --version`, prefer mocking the spawn layer.
|
|
116
|
+
- If a test needs `codex login` or `codex --version`, prefer mocking the spawn layer instead of assuming an installed local binary.
|
|
97
117
|
- Keep fixture assertions focused on stable data such as provider names, active profile, backup count, and typed error codes.
|
|
98
118
|
|
|
99
119
|
## Reporting Template
|
|
@@ -104,17 +124,17 @@ Use this template for release checks:
|
|
|
104
124
|
Version under test: 0.0.x
|
|
105
125
|
Build: PASS/FAIL
|
|
106
126
|
Suite results:
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
127
|
+
- commands: PASS/FAIL
|
|
128
|
+
- cli-e2e: PASS/FAIL
|
|
129
|
+
- interaction: PASS/FAIL
|
|
130
|
+
- runtime: PASS/FAIL
|
|
131
|
+
- workflows: PASS/FAIL
|
|
112
132
|
|
|
113
|
-
Read
|
|
114
|
-
- list/current/status/config/backups/doctor
|
|
133
|
+
Read command checks:
|
|
134
|
+
- help/version/list/show/current/status/config/backups/doctor
|
|
115
135
|
|
|
116
136
|
Mutation checks:
|
|
117
|
-
-
|
|
137
|
+
- init/add/edit/switch/remove/import/export/rollback/migrate/setup
|
|
118
138
|
|
|
119
139
|
Open risks:
|
|
120
140
|
- <risk 1>
|
|
@@ -125,7 +145,7 @@ Open risks:
|
|
|
125
145
|
|
|
126
146
|
Known areas that still deserve more coverage:
|
|
127
147
|
|
|
128
|
-
- true subprocess
|
|
148
|
+
- true subprocess automation for interactive TTY-only flows such as prompt-driven `migrate`
|
|
129
149
|
- explicit tests for `rollback-latest`
|
|
130
150
|
- more backup corruption cases inside historical manifests
|
|
131
|
-
-
|
|
151
|
+
- docs and report snapshots should stay in sync with the current package version
|