The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | // Agent shells carry real provider credentials (CLIProxy sets ANTHROPIC_AUTH_TOKEN and |
| 2 | // ANTHROPIC_BASE_URL) and the agent's own T3 state. Tests that read the ambient environment |
| 3 | // then pass or fail by who runs them. Tests that need one of these variables set it |
| 4 | // themselves. Set T3CODE_TEST_KEEP_PROVIDER_ENV=1 to keep them, for example for a live run. |
| 5 | const PROVIDER_ENV_PREFIXES = ["ANTHROPIC_", "CLAUDE_", "CODEX_", "OPENAI_", "T3CODE_"]; |
| 6 | |
| 7 | const KEPT_ENV = new Set([ |
| 8 | // CI sets these so the transfer budget integration test writes its report for the job summary. |
| 9 | "T3CODE_TRANSFER_BUDGET_REPORT_PATH", |
| 10 | "T3CODE_TRANSFER_BUDGET_RESULT_PATH", |
| 11 | "T3CODE_TRANSFER_BUDGET_SCENARIOS_PATH", |
| 12 | // Opt-in: points the HtmlRender tests at a headless browser, which they skip without. |
| 13 | "T3CODE_TEST_HEADLESS_SHELL", |
| 14 | ]); |
| 15 | |
| 16 | if (process.env.T3CODE_TEST_KEEP_PROVIDER_ENV !== "1") { |
| 17 | for (const key of Object.keys(process.env)) { |
| 18 | if (KEPT_ENV.has(key)) continue; |
| 19 | if (PROVIDER_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))) { |
| 20 | delete process.env[key]; |
| 21 | } |
| 22 | } |
| 23 | } |