gitarsenal-cli 1.3.6 โ 1.3.7
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/package.json
CHANGED
Binary file
|
@@ -41,12 +41,12 @@ def fetch_tokens_from_proxy(proxy_url=None, api_key=None):
|
|
41
41
|
# Check if we have the necessary information
|
42
42
|
if not proxy_url:
|
43
43
|
print("โ No proxy URL provided or found in environment")
|
44
|
-
print("๐ก Set MODAL_PROXY_URL environment variable or use --proxy-url argument")
|
44
|
+
# print("๐ก Set MODAL_PROXY_URL environment variable or use --proxy-url argument")
|
45
45
|
return None, None
|
46
46
|
|
47
47
|
if not api_key:
|
48
48
|
print("โ No API key provided or found in environment")
|
49
|
-
print("๐ก Set MODAL_PROXY_API_KEY environment variable or use --proxy-api-key argument")
|
49
|
+
# print("๐ก Set MODAL_PROXY_API_KEY environment variable or use --proxy-api-key argument")
|
50
50
|
return None, None
|
51
51
|
|
52
52
|
# Ensure the URL ends with a slash
|
@@ -103,7 +103,7 @@ def get_tokens():
|
|
103
103
|
# Set the tokens in environment variables
|
104
104
|
os.environ["MODAL_TOKEN_ID"] = token_id
|
105
105
|
os.environ["MODAL_TOKEN_SECRET"] = token_secret
|
106
|
-
print(f"โ
Set MODAL_TOKEN_ID and MODAL_TOKEN_SECRET environment variables")
|
106
|
+
# print(f"โ
Set MODAL_TOKEN_ID and MODAL_TOKEN_SECRET environment variables")
|
107
107
|
|
108
108
|
return token_id, token_secret
|
109
109
|
|
@@ -119,25 +119,25 @@ if __name__ == "__main__":
|
|
119
119
|
# Set proxy URL and API key in environment variables if provided
|
120
120
|
if args.proxy_url:
|
121
121
|
os.environ["MODAL_PROXY_URL"] = args.proxy_url
|
122
|
-
print(f"โ
Set MODAL_PROXY_URL from command line")
|
122
|
+
# print(f"โ
Set MODAL_PROXY_URL from command line")
|
123
123
|
|
124
124
|
if args.proxy_api_key:
|
125
125
|
os.environ["MODAL_PROXY_API_KEY"] = args.proxy_api_key
|
126
|
-
print(f"โ
Set MODAL_PROXY_API_KEY from command line")
|
126
|
+
# print(f"โ
Set MODAL_PROXY_API_KEY from command line")
|
127
127
|
|
128
128
|
# Get tokens
|
129
129
|
token_id, token_secret = get_tokens()
|
130
|
-
print(f"Token ID: [HIDDEN]")
|
131
|
-
print(f"Token Secret: [HIDDEN]")
|
132
|
-
|
133
|
-
# Check if tokens are set in environment variables
|
134
|
-
print(f"\n๐ DEBUG: Checking environment variables")
|
135
|
-
print(f"๐ MODAL_TOKEN_ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
|
136
|
-
print(f"๐ MODAL_TOKEN_SECRET exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
|
137
|
-
if os.environ.get('MODAL_TOKEN_ID'):
|
138
|
-
|
139
|
-
if os.environ.get('MODAL_TOKEN_SECRET'):
|
140
|
-
|
130
|
+
# print(f"Token ID: [HIDDEN]")
|
131
|
+
# print(f"Token Secret: [HIDDEN]")
|
132
|
+
|
133
|
+
# # Check if tokens are set in environment variables
|
134
|
+
# print(f"\n๐ DEBUG: Checking environment variables")
|
135
|
+
# print(f"๐ MODAL_TOKEN_ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
|
136
|
+
# print(f"๐ MODAL_TOKEN_SECRET exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
|
137
|
+
# if os.environ.get('MODAL_TOKEN_ID'):
|
138
|
+
# print(f"๐ MODAL_TOKEN_ID length: {len(os.environ.get('MODAL_TOKEN_ID'))}")
|
139
|
+
# if os.environ.get('MODAL_TOKEN_SECRET'):
|
140
|
+
# print(f"๐ MODAL_TOKEN_SECRET length: {len(os.environ.get('MODAL_TOKEN_SECRET'))}")
|
141
141
|
|
142
142
|
# Write the tokens to a file for use by other scripts
|
143
143
|
tokens_file = Path(__file__).parent / "modal_tokens.json"
|
@@ -24,24 +24,22 @@ try:
|
|
24
24
|
# First, try to import the fetch_modal_tokens module
|
25
25
|
from fetch_modal_tokens import get_tokens
|
26
26
|
TOKEN_ID, TOKEN_SECRET = get_tokens()
|
27
|
-
print(f"โ
Using tokens from proxy server or defaults")
|
27
|
+
# print(f"โ
Using tokens from proxy server or defaults")
|
28
28
|
except ImportError:
|
29
29
|
# If the module is not available, use hardcoded tokens
|
30
|
-
|
31
|
-
TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
|
32
|
-
print(f"โ ๏ธ Using default tokens")
|
30
|
+
# print(f"โ ๏ธ Using default tokens")
|
33
31
|
|
34
|
-
print("๐ง Advanced Modal Token Fixer")
|
32
|
+
# print("๐ง Advanced Modal Token Fixer")
|
35
33
|
|
36
34
|
# Approach 1: Set environment variables
|
37
|
-
print("\n๐ Approach 1: Setting environment variables")
|
35
|
+
# print("\n๐ Approach 1: Setting environment variables")
|
38
36
|
os.environ["MODAL_TOKEN_ID"] = TOKEN_ID
|
39
37
|
os.environ["MODAL_TOKEN_SECRET"] = TOKEN_SECRET
|
40
|
-
print(f"โ
Set MODAL_TOKEN_ID = [HIDDEN]")
|
41
|
-
print(f"โ
Set MODAL_TOKEN_SECRET = [HIDDEN]")
|
38
|
+
# print(f"โ
Set MODAL_TOKEN_ID = [HIDDEN]")
|
39
|
+
# print(f"โ
Set MODAL_TOKEN_SECRET = [HIDDEN]")
|
42
40
|
|
43
41
|
# Approach 2: Create token files in various formats
|
44
|
-
print("\n๐ Approach 2: Creating token files in various formats")
|
42
|
+
# print("\n๐ Approach 2: Creating token files in various formats")
|
45
43
|
modal_dir = Path.home() / ".modal"
|
46
44
|
modal_dir.mkdir(exist_ok=True)
|
47
45
|
|
@@ -53,7 +51,7 @@ with open(token_file, 'w') as f:
|
|
53
51
|
"token_secret": TOKEN_SECRET
|
54
52
|
}
|
55
53
|
json.dump(token_data, f)
|
56
|
-
print(f"โ
Created token file at {token_file}")
|
54
|
+
# print(f"โ
Created token file at {token_file}")
|
57
55
|
|
58
56
|
# Format 2: Alternative token.json format
|
59
57
|
token_file_alt = modal_dir / "token_alt.json"
|
@@ -63,14 +61,14 @@ with open(token_file_alt, 'w') as f:
|
|
63
61
|
"secret": TOKEN_SECRET
|
64
62
|
}
|
65
63
|
json.dump(token_data_alt, f)
|
66
|
-
print(f"โ
Created alternative token file at {token_file_alt}")
|
64
|
+
# print(f"โ
Created alternative token file at {token_file_alt}")
|
67
65
|
|
68
66
|
# Format 3: Create .modalconfig file
|
69
67
|
modalconfig_file = Path.home() / ".modalconfig"
|
70
68
|
with open(modalconfig_file, 'w') as f:
|
71
69
|
f.write(f"token_id = {TOKEN_ID}\n")
|
72
70
|
f.write(f"token_secret = {TOKEN_SECRET}\n")
|
73
|
-
print(f"โ
Created .modalconfig file at {modalconfig_file}")
|
71
|
+
# print(f"โ
Created .modalconfig file at {modalconfig_file}")
|
74
72
|
|
75
73
|
# Format 4: Create config.json file
|
76
74
|
config_file = modal_dir / "config.json"
|
@@ -80,10 +78,10 @@ with open(config_file, 'w') as f:
|
|
80
78
|
"token_secret": TOKEN_SECRET
|
81
79
|
}
|
82
80
|
json.dump(config_data, f)
|
83
|
-
print(f"โ
Created config.json file at {config_file}")
|
81
|
+
# print(f"โ
Created config.json file at {config_file}")
|
84
82
|
|
85
83
|
# Approach 3: Use Modal CLI to set token
|
86
|
-
print("\n๐ Approach 3: Using Modal CLI")
|
84
|
+
# print("\n๐ Approach 3: Using Modal CLI")
|
87
85
|
try:
|
88
86
|
# Use the CLI to set the token directly
|
89
87
|
result = subprocess.run(
|
@@ -92,17 +90,17 @@ try:
|
|
92
90
|
)
|
93
91
|
|
94
92
|
if result.returncode == 0:
|
95
|
-
print(f"โ
Successfully set token via Modal CLI")
|
93
|
+
# print(f"โ
Successfully set token via Modal CLI")
|
96
94
|
else:
|
97
|
-
print(f"โ Failed to set token via Modal CLI: {result.stderr}")
|
95
|
+
# print(f"โ Failed to set token via Modal CLI: {result.stderr}")
|
98
96
|
except Exception as e:
|
99
|
-
print(f"โ Error using Modal CLI: {e}")
|
97
|
+
# print(f"โ Error using Modal CLI: {e}")
|
100
98
|
|
101
99
|
# Approach 4: Use Modal Python API to set token
|
102
|
-
print("\n๐ Approach 4: Using Modal Python API")
|
100
|
+
# print("\n๐ Approach 4: Using Modal Python API")
|
103
101
|
try:
|
104
102
|
import modal
|
105
|
-
print(f"โ
Successfully imported Modal")
|
103
|
+
# print(f"โ
Successfully imported Modal")
|
106
104
|
|
107
105
|
# Try to set token directly in Modal's config
|
108
106
|
try:
|
@@ -114,49 +112,49 @@ try:
|
|
114
112
|
if hasattr(modal.config, '_auth_config'):
|
115
113
|
modal.config._auth_config.token_id = TOKEN_ID
|
116
114
|
modal.config._auth_config.token_secret = TOKEN_SECRET
|
117
|
-
print(f"โ
Set tokens via _auth_config")
|
115
|
+
# print(f"โ
Set tokens via _auth_config")
|
118
116
|
except Exception as e:
|
119
|
-
print(f"โ Error setting tokens via _auth_config: {e}")
|
117
|
+
# print(f"โ Error setting tokens via _auth_config: {e}")
|
120
118
|
|
121
119
|
try:
|
122
120
|
# Approach 4.2: Set token via set_token() if it exists
|
123
121
|
if hasattr(modal.config, 'set_token'):
|
124
122
|
modal.config.set_token(TOKEN_ID, TOKEN_SECRET)
|
125
|
-
print(f"โ
Set tokens via set_token()")
|
123
|
+
# print(f"โ
Set tokens via set_token()")
|
126
124
|
except Exception as e:
|
127
|
-
print(f"โ Error setting tokens via set_token(): {e}")
|
125
|
+
# print(f"โ Error setting tokens via set_token(): {e}")
|
128
126
|
|
129
127
|
try:
|
130
128
|
# Approach 4.3: Set token via Config
|
131
129
|
if hasattr(modal.config, 'Config'):
|
132
130
|
modal.config.Config.token_id = TOKEN_ID
|
133
131
|
modal.config.Config.token_secret = TOKEN_SECRET
|
134
|
-
print(f"โ
Set tokens via Config")
|
132
|
+
# print(f"โ
Set tokens via Config")
|
135
133
|
except Exception as e:
|
136
|
-
print(f"โ Error setting tokens via Config: {e}")
|
134
|
+
# print(f"โ Error setting tokens via Config: {e}")
|
137
135
|
|
138
136
|
# Approach 4.4: Inspect modal.config and try to find token-related attributes
|
139
|
-
print("\n๐ Inspecting modal.config for token-related attributes...")
|
137
|
+
# print("\n๐ Inspecting modal.config for token-related attributes...")
|
140
138
|
for name in dir(modal.config):
|
141
139
|
if "token" in name.lower() or "auth" in name.lower():
|
142
|
-
print(f"Found potential token-related attribute: {name}")
|
140
|
+
# print(f"Found potential token-related attribute: {name}")
|
143
141
|
try:
|
144
142
|
attr = getattr(modal.config, name)
|
145
143
|
if hasattr(attr, "token_id"):
|
146
|
-
print(f" - Setting token_id in {name}")
|
144
|
+
# print(f" - Setting token_id in {name}")
|
147
145
|
setattr(attr, "token_id", TOKEN_ID)
|
148
146
|
if hasattr(attr, "token_secret"):
|
149
|
-
print(f" - Setting token_secret in {name}")
|
147
|
+
# print(f" - Setting token_secret in {name}")
|
150
148
|
setattr(attr, "token_secret", TOKEN_SECRET)
|
151
149
|
except Exception as e:
|
152
|
-
print(f" - Error setting tokens in {name}: {e}")
|
150
|
+
# print(f" - Error setting tokens in {name}: {e}")
|
153
151
|
except Exception as e:
|
154
|
-
print(f"โ Error setting tokens in Modal config: {e}")
|
152
|
+
# print(f"โ Error setting tokens in Modal config: {e}")
|
155
153
|
except Exception as e:
|
156
154
|
print(f"โ Error importing Modal: {e}")
|
157
155
|
|
158
156
|
# Approach 5: Monkey-patch Modal's authentication system
|
159
|
-
print("\n๐ Approach 5: Monkey-patching Modal's authentication system")
|
157
|
+
# print("\n๐ Approach 5: Monkey-patching Modal's authentication system")
|
160
158
|
try:
|
161
159
|
import modal
|
162
160
|
|
@@ -174,7 +172,7 @@ try:
|
|
174
172
|
try:
|
175
173
|
module = getattr(modal, module_name)
|
176
174
|
auth_related.append((module_name, module))
|
177
|
-
print(f"Found potential auth-related module: {module_name}")
|
175
|
+
# print(f"Found potential auth-related module: {module_name}")
|
178
176
|
except Exception:
|
179
177
|
pass
|
180
178
|
|
@@ -187,25 +185,25 @@ try:
|
|
187
185
|
try:
|
188
186
|
original_func = getattr(module, func_name)
|
189
187
|
if callable(original_func):
|
190
|
-
print(f" - Patching {name}.{func_name} to return token_id")
|
188
|
+
# print(f" - Patching {name}.{func_name} to return token_id")
|
191
189
|
setattr(module, func_name, get_token_id)
|
192
190
|
except Exception as e:
|
193
|
-
print(f" - Error patching {name}.{func_name}: {e}")
|
191
|
+
# print(f" - Error patching {name}.{func_name}: {e}")
|
194
192
|
elif "token_secret" in func_name.lower() or "token" in func_name.lower():
|
195
193
|
try:
|
196
194
|
original_func = getattr(module, func_name)
|
197
195
|
if callable(original_func):
|
198
|
-
print(f" - Patching {name}.{func_name} to return token_secret")
|
196
|
+
# print(f" - Patching {name}.{func_name} to return token_secret")
|
199
197
|
setattr(module, func_name, get_token_secret)
|
200
198
|
except Exception as e:
|
201
|
-
print(f" - Error patching {name}.{func_name}: {e}")
|
199
|
+
# print(f" - Error patching {name}.{func_name}: {e}")
|
202
200
|
|
203
|
-
print(f"โ
Monkey-patching completed")
|
201
|
+
# print(f"โ
Monkey-patching completed")
|
204
202
|
except Exception as e:
|
205
|
-
print(f"โ Error during monkey-patching: {e}")
|
203
|
+
# print(f"โ Error during monkey-patching: {e}")
|
206
204
|
|
207
205
|
# Approach 6: Test Modal authentication
|
208
|
-
print("\n๐ Approach 6: Testing Modal authentication")
|
206
|
+
# print("\n๐ Approach 6: Testing Modal authentication")
|
209
207
|
try:
|
210
208
|
import modal
|
211
209
|
|
@@ -217,14 +215,14 @@ try:
|
|
217
215
|
return "Hello, world!"
|
218
216
|
|
219
217
|
# Try to run the function to test authentication
|
220
|
-
print("Creating a test Modal app...")
|
218
|
+
# print("Creating a test Modal app...")
|
221
219
|
with app.run() as running_app:
|
222
|
-
print("Running the test function...")
|
220
|
+
# print("Running the test function...")
|
223
221
|
result = running_app.hello.remote()
|
224
|
-
print(f"โ
Successfully ran Modal function: {result}")
|
225
|
-
print("๐ Modal authentication is working!")
|
222
|
+
# print(f"โ
Successfully ran Modal function: {result}")
|
223
|
+
# print("๐ Modal authentication is working!")
|
226
224
|
|
227
225
|
except Exception as e:
|
228
|
-
print(f"โ Error testing Modal authentication: {e}")
|
226
|
+
# print(f"โ Error testing Modal authentication: {e}")
|
229
227
|
|
230
|
-
print("\nโ
Done fixing Modal token. Please try your command again.")
|
228
|
+
# print("\nโ
Done fixing Modal token. Please try your command again.")
|
@@ -27,19 +27,19 @@ args, unknown = parser.parse_known_args()
|
|
27
27
|
# Set proxy URL and API key in environment variables if provided
|
28
28
|
if args.proxy_url:
|
29
29
|
os.environ["MODAL_PROXY_URL"] = args.proxy_url
|
30
|
-
print(f"โ
Set MODAL_PROXY_URL from command line")
|
30
|
+
# print(f"โ
Set MODAL_PROXY_URL from command line")
|
31
31
|
|
32
32
|
if args.proxy_api_key:
|
33
33
|
os.environ["MODAL_PROXY_API_KEY"] = args.proxy_api_key
|
34
|
-
print(f"โ
Set MODAL_PROXY_API_KEY from command line")
|
34
|
+
# print(f"โ
Set MODAL_PROXY_API_KEY from command line")
|
35
35
|
|
36
36
|
# First, try to fetch tokens from the proxy server
|
37
37
|
try:
|
38
38
|
# Import the fetch_modal_tokens module
|
39
|
-
print("๐ Fetching tokens from proxy server...")
|
39
|
+
# print("๐ Fetching tokens from proxy server...")
|
40
40
|
from fetch_modal_tokens import get_tokens
|
41
41
|
token_id, token_secret = get_tokens()
|
42
|
-
print(f"โ
Tokens fetched successfully")
|
42
|
+
# print(f"โ
Tokens fetched successfully")
|
43
43
|
|
44
44
|
# Explicitly set the environment variables again to be sure
|
45
45
|
os.environ["MODAL_TOKEN_ID"] = token_id
|
@@ -56,26 +56,26 @@ except Exception as e:
|
|
56
56
|
# Apply the comprehensive Modal token solution as fallback
|
57
57
|
try:
|
58
58
|
# Import the comprehensive solution module
|
59
|
-
print("๐ Applying comprehensive Modal token solution...")
|
59
|
+
# print("๐ Applying comprehensive Modal token solution...")
|
60
60
|
import modal_token_solution
|
61
|
-
print("โ
Comprehensive Modal token solution applied")
|
61
|
+
# print("โ
Comprehensive Modal token solution applied")
|
62
62
|
|
63
63
|
# Set token variables for later use
|
64
64
|
token = modal_token_solution.TOKEN_ID # For backward compatibility
|
65
65
|
except Exception as e:
|
66
|
-
print(f"โ ๏ธ Error applying comprehensive Modal token solution: {e}")
|
66
|
+
# print(f"โ ๏ธ Error applying comprehensive Modal token solution: {e}")
|
67
67
|
|
68
68
|
# Fall back to the authentication patch
|
69
69
|
try:
|
70
70
|
# Import the patch module
|
71
|
-
print("๐ Falling back to Modal authentication patch...")
|
71
|
+
# print("๐ Falling back to Modal authentication patch...")
|
72
72
|
import modal_auth_patch
|
73
|
-
print("โ
Modal authentication patch applied")
|
73
|
+
# print("โ
Modal authentication patch applied")
|
74
74
|
|
75
75
|
# Set token variables for later use
|
76
76
|
token = modal_auth_patch.TOKEN_ID # For backward compatibility
|
77
77
|
except Exception as e:
|
78
|
-
print(f"โ ๏ธ Error applying Modal authentication patch: {e}")
|
78
|
+
# print(f"โ ๏ธ Error applying Modal authentication patch: {e}")
|
79
79
|
|
80
80
|
# Fall back to fix_modal_token.py
|
81
81
|
try:
|
@@ -115,17 +115,17 @@ except Exception as e:
|
|
115
115
|
token = "ak-sLhYqCjkvixiYcb9LAuCHp" # Default token ID
|
116
116
|
|
117
117
|
# Print debug info
|
118
|
-
print(f"๐ DEBUG: Checking environment variables")
|
119
|
-
print(f"๐ Token ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
|
120
|
-
print(f"๐ Token secret exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
|
121
|
-
print(f"๐ Token exists: {'Yes' if os.environ.get('MODAL_TOKEN') else 'No'}")
|
122
|
-
if os.environ.get('MODAL_TOKEN_ID'):
|
123
|
-
|
124
|
-
if os.environ.get('MODAL_TOKEN_SECRET'):
|
125
|
-
|
126
|
-
if os.environ.get('MODAL_TOKEN'):
|
127
|
-
|
128
|
-
print(f"โ
Token setup completed")
|
118
|
+
# print(f"๐ DEBUG: Checking environment variables")
|
119
|
+
# print(f"๐ Token ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
|
120
|
+
# print(f"๐ Token secret exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
|
121
|
+
# print(f"๐ Token exists: {'Yes' if os.environ.get('MODAL_TOKEN') else 'No'}")
|
122
|
+
# if os.environ.get('MODAL_TOKEN_ID'):
|
123
|
+
# print(f"๐ Token ID length: {len(os.environ.get('MODAL_TOKEN_ID'))}")
|
124
|
+
# if os.environ.get('MODAL_TOKEN_SECRET'):
|
125
|
+
# print(f"๐ Token secret length: {len(os.environ.get('MODAL_TOKEN_SECRET'))}")
|
126
|
+
# if os.environ.get('MODAL_TOKEN'):
|
127
|
+
# print(f"๐ Token length: {len(os.environ.get('MODAL_TOKEN'))}")
|
128
|
+
# print(f"โ
Token setup completed")
|
129
129
|
|
130
130
|
# Import modal after token setup
|
131
131
|
import modal
|
@@ -2025,7 +2025,7 @@ cd "{current_dir}"
|
|
2025
2025
|
print("โณ Sandbox will remain running until you terminate it with:")
|
2026
2026
|
print(f"modal sandbox terminate {sandbox_id}")
|
2027
2027
|
|
2028
|
-
# Try to open a new terminal window and connect to the
|
2028
|
+
# Try to open a new terminal window and connect to the containera
|
2029
2029
|
if container_id:
|
2030
2030
|
print("๐ฅ๏ธ Attempting to open new terminal window...")
|
2031
2031
|
# Use osascript to open a new terminal with the modal shell command
|
@@ -2618,32 +2618,44 @@ def fetch_setup_commands_from_api(repo_url):
|
|
2618
2618
|
else:
|
2619
2619
|
print(f"โ
GitIngest analysis completed successfully")
|
2620
2620
|
|
2621
|
-
# Read the output file -
|
2621
|
+
# Read the output file - GitIngest outputs structured text, not JSON
|
2622
2622
|
try:
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2623
|
+
with open(output_file, 'r', encoding='utf-8') as f:
|
2624
|
+
content = f.read()
|
2625
|
+
|
2626
|
+
# Process the text output into a structured format
|
2627
|
+
print(f"๐ Processing GitIngest text output")
|
2628
|
+
|
2629
|
+
# Extract key information from the text output
|
2630
|
+
import re
|
2631
|
+
|
2632
|
+
# Try to identify language
|
2633
|
+
language_match = re.search(r"(?i)language[s]?:?\s*(\w+)", content)
|
2634
|
+
detected_language = language_match.group(1) if language_match else "Unknown"
|
2635
|
+
|
2636
|
+
# Try to identify technologies
|
2637
|
+
tech_matches = re.findall(r"(?i)(python|javascript|typescript|react|node|vue|angular|django|flask|express|pytorch|tensorflow|rust|go|ruby|rails|php|laravel|c\+\+|java|kotlin|swift)", content)
|
2638
|
+
detected_technologies = list(set(tech_matches)) if tech_matches else []
|
2639
|
+
|
2640
|
+
# Create a structured representation
|
2641
|
+
gitingest_data = {
|
2642
|
+
"system_info": {
|
2643
|
+
"detected_language": detected_language,
|
2644
|
+
"detected_technologies": detected_technologies,
|
2645
|
+
},
|
2646
|
+
"repository_analysis": {
|
2647
|
+
"summary": content[:1000], # First 1000 chars as summary
|
2648
|
+
"content_preview": content[:5000] # First 5000 chars as preview
|
2649
|
+
},
|
2650
|
+
"raw_text": content[:10000], # Include a portion of the raw text
|
2651
|
+
"success": True
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
print(f"๐ Processed GitIngest output: Detected language: {detected_language}, Technologies: {', '.join(detected_technologies) if detected_technologies else 'None'}")
|
2655
|
+
|
2656
|
+
except FileNotFoundError:
|
2657
|
+
print(f"โ ๏ธ Output file not found at {output_file}")
|
2658
|
+
gitingest_data = generate_basic_repo_analysis_from_url(repo_url)
|
2647
2659
|
except Exception as e:
|
2648
2660
|
print(f"โ ๏ธ Error reading GitIngest output: {e}")
|
2649
2661
|
gitingest_data = generate_basic_repo_analysis_from_url(repo_url)
|
@@ -2660,10 +2672,10 @@ def fetch_setup_commands_from_api(repo_url):
|
|
2660
2672
|
|
2661
2673
|
print(f"๐ค API Request payload prepared (GitIngest data size: {len(json.dumps(gitingest_data))} bytes)")
|
2662
2674
|
|
2663
|
-
# Make the API request
|
2675
|
+
# Make the API request with a shorter timeout to avoid long waits
|
2664
2676
|
print(f"๐ Making POST request to: {api_url}")
|
2665
2677
|
try:
|
2666
|
-
response = requests.post(api_url, json=payload, timeout=
|
2678
|
+
response = requests.post(api_url, json=payload, timeout=30) # Reduced timeout to 30 seconds
|
2667
2679
|
|
2668
2680
|
print(f"๐ฅ API Response status code: {response.status_code}")
|
2669
2681
|
|
@@ -2708,43 +2720,68 @@ def fetch_setup_commands_from_api(repo_url):
|
|
2708
2720
|
print("๐ Available fields in response:")
|
2709
2721
|
for key in data.keys():
|
2710
2722
|
print(f" - {key}")
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2723
|
+
|
2724
|
+
# Generate fallback commands based on the gitingest data
|
2725
|
+
print("\n" + "="*80)
|
2726
|
+
print("๐ GENERATING FALLBACK SETUP COMMANDS")
|
2727
|
+
print("="*80)
|
2728
|
+
fallback_commands = generate_fallback_commands(gitingest_data)
|
2729
|
+
return fallback_commands
|
2730
|
+
except Exception as e:
|
2731
|
+
print(f"โ ๏ธ Error parsing API response: {e}")
|
2718
2732
|
elif response.status_code == 504:
|
2719
2733
|
print(f"โ API request timed out (504 Gateway Timeout)")
|
2720
|
-
print("โ ๏ธ The server took too long to respond. Using fallback commands instead.")
|
2721
|
-
|
2722
|
-
|
2734
|
+
print(f"โ ๏ธ The server took too long to respond. Using fallback commands instead.")
|
2735
|
+
|
2736
|
+
# Generate fallback commands based on the gitingest data
|
2737
|
+
print("\n" + "="*80)
|
2738
|
+
print("๐ GENERATING FALLBACK SETUP COMMANDS")
|
2739
|
+
print("="*80)
|
2740
|
+
fallback_commands = generate_fallback_commands(gitingest_data)
|
2741
|
+
return fallback_commands
|
2723
2742
|
else:
|
2724
|
-
print(f"โ API request failed with status code
|
2725
|
-
print(f"
|
2726
|
-
|
2727
|
-
|
2743
|
+
print(f"โ API request failed with status code {response.status_code}")
|
2744
|
+
print(f"Response: {response.text[:500]}")
|
2745
|
+
|
2746
|
+
# Generate fallback commands based on the gitingest data
|
2747
|
+
print("\n" + "="*80)
|
2748
|
+
print("๐ GENERATING FALLBACK SETUP COMMANDS")
|
2749
|
+
print("="*80)
|
2750
|
+
fallback_commands = generate_fallback_commands(gitingest_data)
|
2751
|
+
return fallback_commands
|
2728
2752
|
except requests.exceptions.Timeout:
|
2729
|
-
print("โ API request timed out after
|
2730
|
-
print("โ ๏ธ Using fallback commands instead")
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
print(
|
2735
|
-
print("
|
2736
|
-
|
2737
|
-
return
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2753
|
+
print(f"โ API request timed out after 30 seconds")
|
2754
|
+
print(f"โ ๏ธ The server took too long to respond. Using fallback commands instead.")
|
2755
|
+
|
2756
|
+
# Generate fallback commands based on the gitingest data
|
2757
|
+
print("\n" + "="*80)
|
2758
|
+
print("๐ GENERATING FALLBACK SETUP COMMANDS")
|
2759
|
+
print("="*80)
|
2760
|
+
fallback_commands = generate_fallback_commands(gitingest_data)
|
2761
|
+
return fallback_commands
|
2762
|
+
except Exception as e:
|
2763
|
+
print(f"โ Error making API request: {e}")
|
2764
|
+
|
2765
|
+
# Generate fallback commands based on the gitingest data
|
2766
|
+
print("\n" + "="*80)
|
2767
|
+
print("๐ GENERATING FALLBACK SETUP COMMANDS")
|
2768
|
+
print("="*80)
|
2769
|
+
fallback_commands = generate_fallback_commands(gitingest_data)
|
2770
|
+
return fallback_commands
|
2744
2771
|
finally:
|
2745
|
-
# Clean up
|
2772
|
+
# Clean up temporary directory
|
2746
2773
|
print(f"๐งน Cleaning up temporary directory...")
|
2747
|
-
|
2774
|
+
try:
|
2775
|
+
shutil.rmtree(temp_dir)
|
2776
|
+
except Exception as e:
|
2777
|
+
print(f"โ ๏ธ Error cleaning up temporary directory: {e}")
|
2778
|
+
|
2779
|
+
# If all else fails, return basic setup commands
|
2780
|
+
return [
|
2781
|
+
"apt-get update -y",
|
2782
|
+
"apt-get install -y git curl wget",
|
2783
|
+
"pip install --upgrade pip setuptools wheel"
|
2784
|
+
]
|
2748
2785
|
|
2749
2786
|
def generate_fallback_commands(gitingest_data):
|
2750
2787
|
"""Generate fallback setup commands based on repository analysis"""
|
@@ -3309,24 +3346,24 @@ def cleanup_modal_token():
|
|
3309
3346
|
# Remove token from environment variables
|
3310
3347
|
if "MODAL_TOKEN_ID" in os.environ:
|
3311
3348
|
del os.environ["MODAL_TOKEN_ID"]
|
3312
|
-
print("โ
Removed token ID from environment")
|
3349
|
+
# print("โ
Removed token ID from environment")
|
3313
3350
|
|
3314
3351
|
if "MODAL_TOKEN" in os.environ:
|
3315
3352
|
del os.environ["MODAL_TOKEN"]
|
3316
|
-
print("โ
Removed token from environment")
|
3353
|
+
# print("โ
Removed token from environment")
|
3317
3354
|
|
3318
3355
|
if "MODAL_TOKEN_SECRET" in os.environ:
|
3319
3356
|
del os.environ["MODAL_TOKEN_SECRET"]
|
3320
|
-
print("โ
Removed token secret from environment")
|
3357
|
+
# print("โ
Removed token secret from environment")
|
3321
3358
|
|
3322
3359
|
# Delete ~/.modal.toml file
|
3323
3360
|
home_dir = os.path.expanduser("~")
|
3324
3361
|
modal_toml = os.path.join(home_dir, ".modal.toml")
|
3325
3362
|
if os.path.exists(modal_toml):
|
3326
3363
|
os.remove(modal_toml)
|
3327
|
-
print(f"โ
Deleted token file at {modal_toml}")
|
3364
|
+
# print(f"โ
Deleted token file at {modal_toml}")
|
3328
3365
|
|
3329
|
-
print("โ
Token cleanup completed successfully")
|
3366
|
+
# print("โ
Token cleanup completed successfully")
|
3330
3367
|
except Exception as e:
|
3331
3368
|
print(f"โ Error during token cleanup: {e}")
|
3332
3369
|
|
@@ -3492,12 +3529,12 @@ if __name__ == "__main__":
|
|
3492
3529
|
ssh_password=ssh_password
|
3493
3530
|
)
|
3494
3531
|
except KeyboardInterrupt:
|
3495
|
-
print("\n\n๐ Execution interrupted")
|
3496
|
-
print("๐งน Cleaning up resources...")
|
3532
|
+
# print("\n\n๐ Execution interrupted")
|
3533
|
+
# print("๐งน Cleaning up resources...")
|
3497
3534
|
cleanup_modal_token()
|
3498
3535
|
sys.exit(1)
|
3499
3536
|
except Exception as e:
|
3500
|
-
print(f"\nโ Error: {e}")
|
3501
|
-
print("๐งน Cleaning up resources...")
|
3537
|
+
# print(f"\nโ Error: {e}")
|
3538
|
+
# print("๐งน Cleaning up resources...")
|
3502
3539
|
cleanup_modal_token()
|
3503
3540
|
sys.exit(1)
|
@@ -1,79 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
This script removes emojis from the test_modalSandboxScript.py file to fix syntax errors.
|
4
|
-
"""
|
5
|
-
|
6
|
-
import re
|
7
|
-
import sys
|
8
|
-
import shutil
|
9
|
-
from pathlib import Path
|
10
|
-
|
11
|
-
def remove_emojis(script_path):
|
12
|
-
"""
|
13
|
-
Remove emojis from the Python script to fix syntax errors.
|
14
|
-
"""
|
15
|
-
print(f"Removing emojis from {script_path}...")
|
16
|
-
|
17
|
-
# Make a backup of the original file
|
18
|
-
backup_path = f"{script_path}.emoji_backup"
|
19
|
-
shutil.copy2(script_path, backup_path)
|
20
|
-
|
21
|
-
# Read the file
|
22
|
-
with open(script_path, 'r', encoding='utf-8', errors='ignore') as f:
|
23
|
-
content = f.read()
|
24
|
-
|
25
|
-
# Emoji pattern - matches most common emoji characters
|
26
|
-
emoji_pattern = re.compile(
|
27
|
-
"["
|
28
|
-
"\U0001F1E0-\U0001F1FF" # flags (iOS)
|
29
|
-
"\U0001F300-\U0001F5FF" # symbols & pictographs
|
30
|
-
"\U0001F600-\U0001F64F" # emoticons
|
31
|
-
"\U0001F680-\U0001F6FF" # transport & map symbols
|
32
|
-
"\U0001F700-\U0001F77F" # alchemical symbols
|
33
|
-
"\U0001F780-\U0001F7FF" # Geometric Shapes
|
34
|
-
"\U0001F800-\U0001F8FF" # Supplemental Arrows-C
|
35
|
-
"\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
|
36
|
-
"\U0001FA00-\U0001FA6F" # Chess Symbols
|
37
|
-
"\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
|
38
|
-
"\U00002702-\U000027B0" # Dingbats
|
39
|
-
"\U000024C2-\U0001F251"
|
40
|
-
"]+", flags=re.UNICODE)
|
41
|
-
|
42
|
-
# Simply remove all emojis
|
43
|
-
content = emoji_pattern.sub('', content)
|
44
|
-
|
45
|
-
# Fix common syntax issues after emoji removal
|
46
|
-
content = re.sub(r'print\(\s*\)', r'print()', content)
|
47
|
-
content = re.sub(r'print\(\s*"', r'print("', content)
|
48
|
-
|
49
|
-
# Fix specific syntax errors
|
50
|
-
content = re.sub(r'print\(\s*container\'s', r'print("container\'s', content)
|
51
|
-
|
52
|
-
# Write the modified content back to the file
|
53
|
-
with open(script_path, 'w', encoding='utf-8') as f:
|
54
|
-
f.write(content)
|
55
|
-
|
56
|
-
print(f"Emoji removal complete. Original file backed up to {backup_path}")
|
57
|
-
return True
|
58
|
-
|
59
|
-
def main():
|
60
|
-
"""
|
61
|
-
Main entry point for the script.
|
62
|
-
"""
|
63
|
-
# Get the path to the script
|
64
|
-
script_dir = Path(__file__).parent
|
65
|
-
script_path = script_dir / "test_modalSandboxScript.py"
|
66
|
-
|
67
|
-
if not script_path.exists():
|
68
|
-
print(f"Error: Script not found at {script_path}")
|
69
|
-
return 1
|
70
|
-
|
71
|
-
try:
|
72
|
-
remove_emojis(script_path)
|
73
|
-
return 0
|
74
|
-
except Exception as e:
|
75
|
-
print(f"Error removing emojis: {e}")
|
76
|
-
return 1
|
77
|
-
|
78
|
-
if __name__ == "__main__":
|
79
|
-
sys.exit(main())
|