ai-code-switcher 0.1.6__tar.gz → 0.1.7__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.
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/PKG-INFO +1 -1
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/pyproject.toml +1 -1
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/PKG-INFO +1 -1
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/launcher.py +15 -4
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/models.py +1 -1
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/tests/test_integration.py +4 -4
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/tests/test_launcher.py +4 -4
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/README.md +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/setup.cfg +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/SOURCES.txt +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/dependency_links.txt +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/entry_points.txt +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/requires.txt +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/top_level.txt +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/__init__.py +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/cli.py +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/config.py +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/code_ai/profiles.py +0 -0
- {ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/tests/test_models.py +0 -0
|
@@ -14,7 +14,7 @@ ENV_MAP = {
|
|
|
14
14
|
"cmd": "gemini",
|
|
15
15
|
},
|
|
16
16
|
"codex": {
|
|
17
|
-
"env": {"OPENAI_API_KEY": "api_key"},
|
|
17
|
+
"env": {"OPENAI_BASE_URL": "base_url", "OPENAI_API_KEY": "api_key"},
|
|
18
18
|
"cmd": "codex",
|
|
19
19
|
},
|
|
20
20
|
}
|
|
@@ -37,9 +37,20 @@ def prepare_environment(profile):
|
|
|
37
37
|
env.pop(env_var, None)
|
|
38
38
|
# Expand ~ to home directory
|
|
39
39
|
credentials_path = os.path.expanduser(profile.credentials_path)
|
|
40
|
-
# Set the appropriate
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
# Set the appropriate config dir env var based on profile type
|
|
41
|
+
# Claude uses CLAUDE_CONFIG_DIR, Codex uses CODEX_HOME
|
|
42
|
+
config_dir_vars = {"claude": "CLAUDE_CONFIG_DIR", "codex": "CODEX_HOME"}
|
|
43
|
+
config_dir_var = config_dir_vars.get(ptype)
|
|
44
|
+
if config_dir_var:
|
|
45
|
+
os.makedirs(credentials_path, exist_ok=True)
|
|
46
|
+
# For codex: ensure config.toml exists with default openai provider
|
|
47
|
+
# to prevent inheriting custom providers from ~/.codex/config.toml
|
|
48
|
+
if ptype == "codex":
|
|
49
|
+
config_toml = os.path.join(credentials_path, "config.toml")
|
|
50
|
+
if not os.path.exists(config_toml):
|
|
51
|
+
with open(config_toml, "w") as f:
|
|
52
|
+
f.write('model_provider = "openai"\n')
|
|
53
|
+
env[config_dir_var] = credentials_path
|
|
43
54
|
elif isinstance(profile, ApiProfile):
|
|
44
55
|
# API mode: set API environment variables
|
|
45
56
|
for env_var, config_key in spec["env"].items():
|
|
@@ -22,7 +22,7 @@ class ApiProfile(BaseProfile):
|
|
|
22
22
|
|
|
23
23
|
@dataclass
|
|
24
24
|
class LoginProfile(BaseProfile):
|
|
25
|
-
"""Login mode: authenticate via OAuth credentials directory (Claude
|
|
25
|
+
"""Login mode: authenticate via OAuth credentials directory (Claude/Codex)"""
|
|
26
26
|
credentials_path: str = "" # Path to existing OAuth credentials
|
|
27
27
|
|
|
28
28
|
|
|
@@ -261,9 +261,9 @@ class TestCodexProfiles:
|
|
|
261
261
|
|
|
262
262
|
# Test environment preparation
|
|
263
263
|
env = prepare_environment(profile)
|
|
264
|
-
# Should
|
|
264
|
+
# Should have both OPENAI_API_KEY and OPENAI_BASE_URL
|
|
265
265
|
assert env["OPENAI_API_KEY"] == "sk-test-key"
|
|
266
|
-
assert "OPENAI_BASE_URL"
|
|
266
|
+
assert env["OPENAI_BASE_URL"] == "https://api.openai.com/v1"
|
|
267
267
|
|
|
268
268
|
def test_codex_login_profile(self, tmp_path):
|
|
269
269
|
"""Test codex login mode profile"""
|
|
@@ -305,7 +305,7 @@ class TestCodexProfiles:
|
|
|
305
305
|
env = prepare_environment(profile)
|
|
306
306
|
# Login mode should NOT have API environment variables
|
|
307
307
|
assert "OPENAI_API_KEY" not in env
|
|
308
|
-
# Should have
|
|
308
|
+
# Should have CODEX_HOME with expanded path
|
|
309
309
|
import os
|
|
310
310
|
expected_path = os.path.expanduser("~/.codex-profiles/account-a")
|
|
311
|
-
assert env["
|
|
311
|
+
assert env["CODEX_HOME"] == expected_path
|
|
@@ -85,9 +85,9 @@ def test_prepare_env_codex_api_mode():
|
|
|
85
85
|
|
|
86
86
|
env = prepare_environment(profile)
|
|
87
87
|
|
|
88
|
-
# Should
|
|
88
|
+
# Should have both OPENAI_API_KEY and OPENAI_BASE_URL
|
|
89
89
|
assert env["OPENAI_API_KEY"] == "sk-test"
|
|
90
|
-
assert "OPENAI_BASE_URL"
|
|
90
|
+
assert env["OPENAI_BASE_URL"] == "https://api.openai.com/v1"
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
def test_prepare_env_codex_login_mode():
|
|
@@ -102,6 +102,6 @@ def test_prepare_env_codex_login_mode():
|
|
|
102
102
|
|
|
103
103
|
# Should NOT have API environment variables
|
|
104
104
|
assert "OPENAI_API_KEY" not in env
|
|
105
|
-
# Should have
|
|
105
|
+
# Should have CODEX_HOME with expanded path
|
|
106
106
|
expected_path = os.path.expanduser("~/.codex-profiles/account-a")
|
|
107
|
-
assert env["
|
|
107
|
+
assert env["CODEX_HOME"] == expected_path
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/requires.txt
RENAMED
|
File without changes
|
{ai_code_switcher-0.1.6 → ai_code_switcher-0.1.7}/src/ai_code_switcher.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|