gitarsenal-cli 1.3.5 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -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
- 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'))}")
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
- TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
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.")