gitarsenal-cli 1.6.12 → 1.6.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/lib/sandbox.js +6 -6
- package/package.json +1 -1
- package/python/fix_modal_token.py +6 -6
- package/python/fix_modal_token_advanced.py +2 -12
- package/python/test_modalSandboxScript.py +23 -0
- package/test_modalSandboxScript.py +23 -0
- package/python/test_dynamic_services.py +0 -67
- package/python/test_interactive_keys.py +0 -34
package/lib/sandbox.js
CHANGED
@@ -110,8 +110,8 @@ async function runContainer(options) {
|
|
110
110
|
// Log the command being executed
|
111
111
|
console.log(chalk.dim(`\nExecuting: python ${args.join(' ')}`));
|
112
112
|
|
113
|
-
//
|
114
|
-
|
113
|
+
// Run the Python script without spinner to avoid terminal interference
|
114
|
+
console.log(chalk.dim('Launching container...'));
|
115
115
|
|
116
116
|
try {
|
117
117
|
// Run the Python script
|
@@ -123,22 +123,22 @@ async function runContainer(options) {
|
|
123
123
|
return new Promise((resolve, reject) => {
|
124
124
|
pythonProcess.on('close', (code) => {
|
125
125
|
if (code === 0) {
|
126
|
-
|
126
|
+
console.log(chalk.green('✅ Container launched successfully'));
|
127
127
|
resolve();
|
128
128
|
} else {
|
129
|
-
|
129
|
+
console.log(chalk.red(`❌ Container launch failed with exit code ${code}`));
|
130
130
|
reject(new Error(`Process exited with code ${code}`));
|
131
131
|
}
|
132
132
|
});
|
133
133
|
|
134
134
|
// Handle process errors
|
135
135
|
pythonProcess.on('error', (error) => {
|
136
|
-
|
136
|
+
console.log(chalk.red(`❌ Failed to start Python process: ${error.message}`));
|
137
137
|
reject(error);
|
138
138
|
});
|
139
139
|
});
|
140
140
|
} catch (error) {
|
141
|
-
|
141
|
+
console.log(chalk.red(`❌ Error launching container: ${error.message}`));
|
142
142
|
throw error;
|
143
143
|
}
|
144
144
|
}
|
package/package.json
CHANGED
@@ -64,15 +64,15 @@ except (ImportError, ValueError) as e:
|
|
64
64
|
modal_dir = Path.home() / ".modal"
|
65
65
|
modal_dir.mkdir(exist_ok=True)
|
66
66
|
token_file = modal_dir / "token.json"
|
67
|
-
with open(token_file, 'w') as f:
|
68
|
-
|
69
|
-
print(f"✅ Created token file at {token_file}")
|
67
|
+
# with open(token_file, 'w') as f:
|
68
|
+
# f.write(f'{{"token_id": "{TOKEN_ID}", "token_secret": "{TOKEN_SECRET}"}}')
|
69
|
+
# print(f"✅ Created token file at {token_file}")
|
70
70
|
|
71
71
|
# Create .modalconfig file
|
72
72
|
modalconfig_file = Path.home() / ".modalconfig"
|
73
|
-
with open(modalconfig_file, 'w') as f:
|
74
|
-
|
75
|
-
|
73
|
+
# with open(modalconfig_file, 'w') as f:
|
74
|
+
# f.write(f"token_id = {TOKEN_ID}\n")
|
75
|
+
# f.write(f"token_secret = {TOKEN_SECRET}\n")
|
76
76
|
print(f"✅ Created .modalconfig file at {modalconfig_file}")
|
77
77
|
|
78
78
|
print("\n✅ Done fixing Modal token. Please try your command again.")
|
@@ -19,23 +19,13 @@ import inspect
|
|
19
19
|
from pathlib import Path
|
20
20
|
import time
|
21
21
|
|
22
|
-
# Try to get tokens from the proxy server
|
23
|
-
try:
|
24
|
-
# First, try to import the fetch_modal_tokens module
|
25
|
-
from fetch_modal_tokens import get_tokens
|
26
|
-
TOKEN_ID, TOKEN_SECRET = get_tokens()
|
27
|
-
# print(f"✅ Using tokens from proxy server or defaults")
|
28
|
-
except ImportError:
|
29
|
-
# If the module is not available, use hardcoded tokens
|
30
|
-
# print(f"⚠️ Using default tokens")
|
31
|
-
print("")
|
32
22
|
|
33
23
|
# print("🔧 Advanced Modal Token Fixer")
|
34
24
|
|
35
25
|
# Approach 1: Set environment variables
|
36
26
|
# print("\n📋 Approach 1: Setting environment variables")
|
37
|
-
os.environ["MODAL_TOKEN_ID"] = TOKEN_ID
|
38
|
-
os.environ["MODAL_TOKEN_SECRET"] = TOKEN_SECRET
|
27
|
+
# os.environ["MODAL_TOKEN_ID"] = TOKEN_ID
|
28
|
+
# os.environ["MODAL_TOKEN_SECRET"] = TOKEN_SECRET
|
39
29
|
# print(f"✅ Set MODAL_TOKEN_ID = [HIDDEN]")
|
40
30
|
# print(f"✅ Set MODAL_TOKEN_SECRET = [HIDDEN]")
|
41
31
|
|
@@ -2359,6 +2359,29 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2359
2359
|
if commands:
|
2360
2360
|
print(f"✅ Successfully fetched {len(commands)} setup commands from API at {api_url}")
|
2361
2361
|
|
2362
|
+
# Enhanced response handling for API key detection
|
2363
|
+
if "requiredApiKeys" in result:
|
2364
|
+
api_keys = result.get("requiredApiKeys", [])
|
2365
|
+
if api_keys:
|
2366
|
+
print(f"\n🔑 Required API Keys ({len(api_keys)}):")
|
2367
|
+
for i, api_key in enumerate(api_keys, 1):
|
2368
|
+
status = "🔴 Required" if api_key.get("required", False) else "🟡 Optional"
|
2369
|
+
print(f" {i}. {api_key.get('name', 'Unknown')} - {status}")
|
2370
|
+
print(f" Service: {api_key.get('service', 'Unknown')}")
|
2371
|
+
print(f" Description: {api_key.get('description', 'No description')}")
|
2372
|
+
if api_key.get('example'):
|
2373
|
+
print(f" Example: {api_key.get('example')}")
|
2374
|
+
if api_key.get('documentation_url'):
|
2375
|
+
print(f" Docs: {api_key.get('documentation_url')}")
|
2376
|
+
print()
|
2377
|
+
|
2378
|
+
# Display setup complexity if available
|
2379
|
+
if "setupComplexity" in result:
|
2380
|
+
complexity = result.get("setupComplexity", "medium")
|
2381
|
+
estimated_time = result.get("estimatedSetupTime", "Unknown")
|
2382
|
+
print(f"📊 Setup Complexity: {complexity.upper()}")
|
2383
|
+
print(f"⏱️ Estimated Time: {estimated_time}")
|
2384
|
+
|
2362
2385
|
# Print the commands
|
2363
2386
|
print("\n📋 Setup Commands:")
|
2364
2387
|
for i, cmd in enumerate(commands, 1):
|
@@ -2359,6 +2359,29 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2359
2359
|
if commands:
|
2360
2360
|
print(f"✅ Successfully fetched {len(commands)} setup commands from API at {api_url}")
|
2361
2361
|
|
2362
|
+
# Enhanced response handling for API key detection
|
2363
|
+
if "requiredApiKeys" in result:
|
2364
|
+
api_keys = result.get("requiredApiKeys", [])
|
2365
|
+
if api_keys:
|
2366
|
+
print(f"\n🔑 Required API Keys ({len(api_keys)}):")
|
2367
|
+
for i, api_key in enumerate(api_keys, 1):
|
2368
|
+
status = "🔴 Required" if api_key.get("required", False) else "🟡 Optional"
|
2369
|
+
print(f" {i}. {api_key.get('name', 'Unknown')} - {status}")
|
2370
|
+
print(f" Service: {api_key.get('service', 'Unknown')}")
|
2371
|
+
print(f" Description: {api_key.get('description', 'No description')}")
|
2372
|
+
if api_key.get('example'):
|
2373
|
+
print(f" Example: {api_key.get('example')}")
|
2374
|
+
if api_key.get('documentation_url'):
|
2375
|
+
print(f" Docs: {api_key.get('documentation_url')}")
|
2376
|
+
print()
|
2377
|
+
|
2378
|
+
# Display setup complexity if available
|
2379
|
+
if "setupComplexity" in result:
|
2380
|
+
complexity = result.get("setupComplexity", "medium")
|
2381
|
+
estimated_time = result.get("estimatedSetupTime", "Unknown")
|
2382
|
+
print(f"📊 Setup Complexity: {complexity.upper()}")
|
2383
|
+
print(f"⏱️ Estimated Time: {estimated_time}")
|
2384
|
+
|
2362
2385
|
# Print the commands
|
2363
2386
|
print("\n📋 Setup Commands:")
|
2364
2387
|
for i, cmd in enumerate(commands, 1):
|
@@ -1,67 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
Test script to verify dynamic service support
|
4
|
-
"""
|
5
|
-
|
6
|
-
import sys
|
7
|
-
import os
|
8
|
-
from gitarsenal_keys import main
|
9
|
-
|
10
|
-
def test_dynamic_services():
|
11
|
-
print("🧪 Testing GitArsenal Dynamic Service Support")
|
12
|
-
print("=" * 60)
|
13
|
-
|
14
|
-
# Test adding a new service (claude)
|
15
|
-
print("\n1. Testing Claude service addition...")
|
16
|
-
sys.argv = ['gitarsenal_keys.py', 'add', '--service', 'claude', '--key', 'sk-test-claude-key']
|
17
|
-
|
18
|
-
try:
|
19
|
-
main()
|
20
|
-
print("✅ Claude service test completed")
|
21
|
-
except SystemExit as e:
|
22
|
-
if e.code == 0:
|
23
|
-
print("✅ Claude service test completed successfully")
|
24
|
-
else:
|
25
|
-
print(f"❌ Claude service test failed with exit code {e.code}")
|
26
|
-
|
27
|
-
# Test adding another new service (custom-service)
|
28
|
-
print("\n2. Testing custom service addition...")
|
29
|
-
sys.argv = ['gitarsenal_keys.py', 'add', '--service', 'custom-service', '--key', 'custom-key-123']
|
30
|
-
|
31
|
-
try:
|
32
|
-
main()
|
33
|
-
print("✅ Custom service test completed")
|
34
|
-
except SystemExit as e:
|
35
|
-
if e.code == 0:
|
36
|
-
print("✅ Custom service test completed successfully")
|
37
|
-
else:
|
38
|
-
print(f"❌ Custom service test failed with exit code {e.code}")
|
39
|
-
|
40
|
-
# Test listing to see all services
|
41
|
-
print("\n3. Testing service listing...")
|
42
|
-
sys.argv = ['gitarsenal_keys.py', 'list']
|
43
|
-
|
44
|
-
try:
|
45
|
-
main()
|
46
|
-
print("✅ Service listing test completed")
|
47
|
-
except SystemExit as e:
|
48
|
-
if e.code == 0:
|
49
|
-
print("✅ Service listing test completed successfully")
|
50
|
-
else:
|
51
|
-
print(f"❌ Service listing test failed with exit code {e.code}")
|
52
|
-
|
53
|
-
# Test viewing a specific service
|
54
|
-
print("\n4. Testing service viewing...")
|
55
|
-
sys.argv = ['gitarsenal_keys.py', 'view', '--service', 'claude']
|
56
|
-
|
57
|
-
try:
|
58
|
-
main()
|
59
|
-
print("✅ Service viewing test completed")
|
60
|
-
except SystemExit as e:
|
61
|
-
if e.code == 0:
|
62
|
-
print("✅ Service viewing test completed successfully")
|
63
|
-
else:
|
64
|
-
print(f"❌ Service viewing test failed with exit code {e.code}")
|
65
|
-
|
66
|
-
if __name__ == "__main__":
|
67
|
-
test_dynamic_services()
|
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
Test script to verify interactive key prompting functionality
|
4
|
-
"""
|
5
|
-
|
6
|
-
import sys
|
7
|
-
import os
|
8
|
-
from gitarsenal_keys import main
|
9
|
-
|
10
|
-
def test_interactive_prompting():
|
11
|
-
print("🧪 Testing GitArsenal Interactive Key Prompting")
|
12
|
-
print("=" * 60)
|
13
|
-
|
14
|
-
# Test that the script can be called with just service
|
15
|
-
print("\n1. Testing interactive prompting...")
|
16
|
-
print(" This should prompt for the API key when only service is provided")
|
17
|
-
|
18
|
-
# Simulate command line arguments
|
19
|
-
sys.argv = ['gitarsenal_keys.py', 'add', '--service', 'huggingface']
|
20
|
-
|
21
|
-
try:
|
22
|
-
# This will prompt for the key interactively
|
23
|
-
main()
|
24
|
-
print("✅ Interactive prompting test completed")
|
25
|
-
except SystemExit as e:
|
26
|
-
if e.code == 0:
|
27
|
-
print("✅ Interactive prompting test completed successfully")
|
28
|
-
else:
|
29
|
-
print(f"❌ Interactive prompting test failed with exit code {e.code}")
|
30
|
-
except Exception as e:
|
31
|
-
print(f"❌ Interactive prompting test failed with error: {e}")
|
32
|
-
|
33
|
-
if __name__ == "__main__":
|
34
|
-
test_interactive_prompting()
|