gitarsenal-cli 1.9.12 โ 1.9.14
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/.venv_status.json +1 -1
- package/package.json +1 -1
- package/python/requirements.txt +2 -1
- package/python/test_claude_fallback.py +118 -0
- package/python/test_modalSandboxScript.py +454 -83
- package/scripts/postinstall.js +26 -9
- package/test_modalSandboxScript.py +450 -82
package/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-08-
|
|
1
|
+
{"created":"2025-08-06T07:28:37.576Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
|
package/package.json
CHANGED
package/python/requirements.txt
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Test script to verify Claude fallback functionality
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
# Add the current directory to the path so we can import the main module
|
|
10
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
11
|
+
|
|
12
|
+
def test_claude_fallback():
|
|
13
|
+
"""Test the Claude fallback functionality"""
|
|
14
|
+
print("๐งช Testing Claude fallback functionality...")
|
|
15
|
+
|
|
16
|
+
# Test 1: Check if anthropic is imported correctly
|
|
17
|
+
try:
|
|
18
|
+
from test_modalSandboxScript import anthropic
|
|
19
|
+
if anthropic is not None:
|
|
20
|
+
print("โ
Anthropic library imported successfully")
|
|
21
|
+
else:
|
|
22
|
+
print("โ ๏ธ Anthropic library not available")
|
|
23
|
+
except ImportError as e:
|
|
24
|
+
print(f"โ Failed to import anthropic: {e}")
|
|
25
|
+
return False
|
|
26
|
+
|
|
27
|
+
# Test 2: Check if ANTHROPIC_API_KEY is set
|
|
28
|
+
anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY")
|
|
29
|
+
if anthropic_api_key:
|
|
30
|
+
print("โ
ANTHROPIC_API_KEY found in environment")
|
|
31
|
+
else:
|
|
32
|
+
print("โ ๏ธ ANTHROPIC_API_KEY not found in environment")
|
|
33
|
+
print("๐ก Set ANTHROPIC_API_KEY to test Claude functionality")
|
|
34
|
+
|
|
35
|
+
# Test 3: Test a simple Claude API call
|
|
36
|
+
if anthropic is not None and anthropic_api_key:
|
|
37
|
+
try:
|
|
38
|
+
client = anthropic.Anthropic(api_key=anthropic_api_key)
|
|
39
|
+
message = client.messages.create(
|
|
40
|
+
model="claude-3-5-sonnet-20241022",
|
|
41
|
+
max_tokens=50,
|
|
42
|
+
messages=[
|
|
43
|
+
{"role": "user", "content": "Hello, please respond with 'Claude is working!'"}
|
|
44
|
+
]
|
|
45
|
+
)
|
|
46
|
+
response = message.content[0].text.strip()
|
|
47
|
+
print(f"โ
Claude API test successful: {response}")
|
|
48
|
+
return True
|
|
49
|
+
except Exception as e:
|
|
50
|
+
print(f"โ Claude API test failed: {e}")
|
|
51
|
+
return False
|
|
52
|
+
else:
|
|
53
|
+
print("โ ๏ธ Skipping Claude API test (missing library or API key)")
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
def test_openai_fallback():
|
|
57
|
+
"""Test the OpenAI fallback functionality"""
|
|
58
|
+
print("\n๐งช Testing OpenAI fallback functionality...")
|
|
59
|
+
|
|
60
|
+
# Test 1: Check if OpenAI API key is set
|
|
61
|
+
openai_api_key = os.environ.get("OPENAI_API_KEY")
|
|
62
|
+
if openai_api_key:
|
|
63
|
+
print("โ
OPENAI_API_KEY found in environment")
|
|
64
|
+
else:
|
|
65
|
+
print("โ ๏ธ OPENAI_API_KEY not found in environment")
|
|
66
|
+
print("๐ก Set OPENAI_API_KEY to test OpenAI functionality")
|
|
67
|
+
|
|
68
|
+
# Test 2: Test a simple OpenAI API call
|
|
69
|
+
if openai_api_key:
|
|
70
|
+
try:
|
|
71
|
+
import openai
|
|
72
|
+
client = openai.OpenAI(api_key=openai_api_key)
|
|
73
|
+
response = client.chat.completions.create(
|
|
74
|
+
model="gpt-3.5-turbo",
|
|
75
|
+
messages=[
|
|
76
|
+
{"role": "user", "content": "Hello, please respond with 'OpenAI is working!'"}
|
|
77
|
+
],
|
|
78
|
+
max_tokens=50
|
|
79
|
+
)
|
|
80
|
+
response_text = response.choices[0].message.content.strip()
|
|
81
|
+
print(f"โ
OpenAI API test successful: {response_text}")
|
|
82
|
+
return True
|
|
83
|
+
except Exception as e:
|
|
84
|
+
print(f"โ OpenAI API test failed: {e}")
|
|
85
|
+
return False
|
|
86
|
+
else:
|
|
87
|
+
print("โ ๏ธ Skipping OpenAI API test (missing API key)")
|
|
88
|
+
return False
|
|
89
|
+
|
|
90
|
+
def main():
|
|
91
|
+
"""Main test function"""
|
|
92
|
+
print("๐ Starting Claude fallback tests...")
|
|
93
|
+
print("=" * 50)
|
|
94
|
+
|
|
95
|
+
claude_success = test_claude_fallback()
|
|
96
|
+
openai_success = test_openai_fallback()
|
|
97
|
+
|
|
98
|
+
print("\n" + "=" * 50)
|
|
99
|
+
print("๐ Test Results:")
|
|
100
|
+
print(f"Claude API: {'โ
Working' if claude_success else 'โ Failed'}")
|
|
101
|
+
print(f"OpenAI API: {'โ
Working' if openai_success else 'โ Failed'}")
|
|
102
|
+
|
|
103
|
+
if claude_success and openai_success:
|
|
104
|
+
print("\n๐ Both APIs are working! Claude fallback is ready.")
|
|
105
|
+
elif claude_success:
|
|
106
|
+
print("\nโ
Claude API is working! Can be used as fallback.")
|
|
107
|
+
elif openai_success:
|
|
108
|
+
print("\nโ
OpenAI API is working! Claude fallback will be used when OpenAI fails.")
|
|
109
|
+
else:
|
|
110
|
+
print("\nโ Neither API is working. Please check your API keys.")
|
|
111
|
+
|
|
112
|
+
print("\n๐ก To test the fallback functionality:")
|
|
113
|
+
print("1. Set both OPENAI_API_KEY and ANTHROPIC_API_KEY")
|
|
114
|
+
print("2. Run the main script with a failing command")
|
|
115
|
+
print("3. Watch for '๐ Trying Claude-4-Sonnet as fallback...' messages")
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
main()
|