@minniexcode/codex-switch 0.0.11 → 0.1.0
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 +110 -152
- package/README.CN.md +179 -215
- package/README.md +183 -217
- package/dist/app/add-provider.js +9 -3
- package/dist/app/edit-provider.js +17 -3
- package/dist/app/get-status.js +8 -3
- package/dist/app/list-providers.js +48 -1
- package/dist/app/run-doctor.js +4 -0
- package/dist/cli/output.js +153 -18
- package/dist/commands/handlers.js +10 -6
- package/dist/commands/help.js +9 -5
- package/dist/commands/registry.js +22 -14
- package/dist/domain/config.js +26 -1
- package/dist/domain/providers.js +16 -0
- package/dist/domain/runtime-state.js +30 -8
- package/dist/infra/config-repo.js +16 -206
- package/dist/interaction/interactive.js +16 -6
- package/dist/runtime/copilot-bridge.js +2 -1
- package/dist/storage/config-repo.js +0 -23
- package/docs/Design/codex-switch-v0.0.12-design.md +343 -0
- package/docs/Design/codex-switch-v0.1.0-design.md +152 -0
- package/docs/PRD/codex-switch-prd-v0.0.12.md +279 -0
- package/docs/PRD/codex-switch-prd-v0.1.0.md +217 -317
- package/docs/Tests/testing.md +31 -151
- package/docs/cli-usage.md +223 -524
- package/docs/codex-switch-command-design.md +649 -646
- package/docs/codex-switch-product-overview.md +86 -241
- package/docs/codex-switch-technical-architecture.md +1115 -1112
- package/package.json +51 -51
- package/dist/app/rollback-latest.js +0 -26
package/docs/Tests/testing.md
CHANGED
|
@@ -1,151 +1,31 @@
|
|
|
1
|
-
# Testing Guide
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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()"
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Development Fixture
|
|
40
|
-
|
|
41
|
-
The repository fixture lives at:
|
|
42
|
-
|
|
43
|
-
```text
|
|
44
|
-
dev-codex/local-sandbox/
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
It is used in two different ways:
|
|
48
|
-
|
|
49
|
-
- read-oriented CLI subprocess tests point at it directly
|
|
50
|
-
- write-oriented tests copy it into a temporary directory before running mutations
|
|
51
|
-
|
|
52
|
-
Do not point destructive automation directly at `dev-codex/local-sandbox` unless you intentionally want to update the fixture.
|
|
53
|
-
|
|
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.
|
|
57
|
-
|
|
58
|
-
Covered entrypoint checks:
|
|
59
|
-
|
|
60
|
-
- `--help`
|
|
61
|
-
- `--version`
|
|
62
|
-
|
|
63
|
-
Covered read commands against the repository sandbox:
|
|
64
|
-
|
|
65
|
-
- `list --json`
|
|
66
|
-
- `show --json`
|
|
67
|
-
- `current --json`
|
|
68
|
-
- `status --json`
|
|
69
|
-
- `config show --json`
|
|
70
|
-
- `config list-profiles --json`
|
|
71
|
-
- `backups list --json`
|
|
72
|
-
- `doctor --json`
|
|
73
|
-
|
|
74
|
-
Covered write commands against temporary sandbox copies:
|
|
75
|
-
|
|
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`
|
|
86
|
-
|
|
87
|
-
Covered non-interactive failure contracts:
|
|
88
|
-
|
|
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`
|
|
94
|
-
|
|
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.
|
|
96
|
-
|
|
97
|
-
## Workflow Coverage
|
|
98
|
-
|
|
99
|
-
`tests/workflows.spec.js` keeps the deeper file-backed mutation coverage at the app/dispatch layer.
|
|
100
|
-
|
|
101
|
-
Important workflow scenarios already covered there include:
|
|
102
|
-
|
|
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
|
|
110
|
-
|
|
111
|
-
## Fixture Rules
|
|
112
|
-
|
|
113
|
-
- Prefer `--codex-dir <temp-copy>` for all write tests.
|
|
114
|
-
- Prefer `--json` when assertions need stable output.
|
|
115
|
-
- Treat `show --json` output as sensitive because it includes unmasked API keys.
|
|
116
|
-
- If a test needs `codex login` or `codex --version`, prefer mocking the spawn layer instead of assuming an installed local binary.
|
|
117
|
-
- Keep fixture assertions focused on stable data such as provider names, active profile, backup count, and typed error codes.
|
|
118
|
-
|
|
119
|
-
## Reporting Template
|
|
120
|
-
|
|
121
|
-
Use this template for release checks:
|
|
122
|
-
|
|
123
|
-
```text
|
|
124
|
-
Version under test: 0.0.x
|
|
125
|
-
Build: PASS/FAIL
|
|
126
|
-
Suite results:
|
|
127
|
-
- commands: PASS/FAIL
|
|
128
|
-
- cli-e2e: PASS/FAIL
|
|
129
|
-
- interaction: PASS/FAIL
|
|
130
|
-
- runtime: PASS/FAIL
|
|
131
|
-
- workflows: PASS/FAIL
|
|
132
|
-
|
|
133
|
-
Read command checks:
|
|
134
|
-
- help/version/list/show/current/status/config/backups/doctor
|
|
135
|
-
|
|
136
|
-
Mutation checks:
|
|
137
|
-
- init/add/edit/switch/remove/import/export/rollback/migrate/setup
|
|
138
|
-
|
|
139
|
-
Open risks:
|
|
140
|
-
- <risk 1>
|
|
141
|
-
- <risk 2>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Current Gaps
|
|
145
|
-
|
|
146
|
-
Known areas that still deserve more coverage:
|
|
147
|
-
|
|
148
|
-
- true subprocess automation for interactive TTY-only flows such as prompt-driven `migrate`
|
|
149
|
-
- explicit tests for `rollback-latest`
|
|
150
|
-
- more backup corruption cases inside historical manifests
|
|
151
|
-
- docs and report snapshots should stay in sync with the current package version
|
|
1
|
+
# codex-switch Testing Guide
|
|
2
|
+
|
|
3
|
+
This guide records the release gate for `0.1.0`.
|
|
4
|
+
|
|
5
|
+
## Required checks
|
|
6
|
+
|
|
7
|
+
Run these commands before publishing or reviewing release changes:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm run build
|
|
11
|
+
npm test
|
|
12
|
+
npx tsc --noEmit
|
|
13
|
+
npm pack --dry-run
|
|
14
|
+
node dist/cli.js --help
|
|
15
|
+
node dist/cli.js --version
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Release scenarios
|
|
19
|
+
|
|
20
|
+
- Fresh direct-provider flow: `init -> add -> switch -> status -> doctor`
|
|
21
|
+
- Fresh Copilot flow: `init -> login copilot -> add --copilot -> switch -> status -> doctor`
|
|
22
|
+
- Ambiguous active profile: `list`, `status`, and provider pickers must surface ambiguity instead of inventing a unique current provider
|
|
23
|
+
- `--json` envelope: top-level `ok`, `command`, `data`, `warnings`, and `error` must remain stable
|
|
24
|
+
- `migrate`: advanced adopt helper only
|
|
25
|
+
- `setup`: deprecated entry only
|
|
26
|
+
|
|
27
|
+
## Fixture guidance
|
|
28
|
+
|
|
29
|
+
- Prefer isolated temp directories for mutating tests.
|
|
30
|
+
- Keep fixtures small and realistic.
|
|
31
|
+
- Use `dev-codex/local-sandbox` only when a test needs a representative Codex directory layout.
|