gitarsenal-cli 1.4.2 → 1.4.4

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.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -12,9 +12,55 @@ import requests
12
12
  import subprocess
13
13
  from pathlib import Path
14
14
 
15
- # Default tokens to use if we can't fetch from the server
16
- DEFAULT_TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
17
- DEFAULT_TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq"
15
+ def fetch_default_tokens_from_gitarsenal():
16
+ """
17
+ Fetch default Modal tokens from gitarsenal.dev API.
18
+
19
+ Returns:
20
+ tuple: (token_id, token_secret) if successful, (None, None) otherwise
21
+ """
22
+ endpoint = "https://gitarsenal.dev/api/credentials"
23
+
24
+ try:
25
+ headers = {
26
+ 'User-Agent': 'Python-Modal-Token-Fetcher/1.0',
27
+ 'Accept': 'application/json'
28
+ }
29
+
30
+ print(f"🔗 Fetching default tokens from: {endpoint}")
31
+
32
+ response = requests.get(endpoint, headers=headers, timeout=30)
33
+
34
+ print(f"📊 Status: {response.status_code}")
35
+
36
+ if response.status_code == 200:
37
+ try:
38
+ data = response.json()
39
+ token_id = data.get("modalTokenId")
40
+ token_secret = data.get("modalTokenSecret")
41
+
42
+ if token_id and token_secret:
43
+ print("✅ Successfully fetched default tokens from gitarsenal.dev")
44
+ return token_id, token_secret
45
+ else:
46
+ print("❌ Modal tokens not found in gitarsenal.dev response")
47
+ return None, None
48
+ except json.JSONDecodeError:
49
+ print("❌ Invalid JSON response from gitarsenal.dev")
50
+ return None, None
51
+ else:
52
+ print(f"❌ Failed to fetch from gitarsenal.dev: {response.status_code} - {response.text[:200]}")
53
+ return None, None
54
+
55
+ except requests.exceptions.Timeout:
56
+ print("❌ Request timeout when fetching from gitarsenal.dev")
57
+ return None, None
58
+ except requests.exceptions.ConnectionError:
59
+ print("❌ Connection failed to gitarsenal.dev")
60
+ return None, None
61
+ except requests.exceptions.RequestException as e:
62
+ print(f"❌ Request failed to gitarsenal.dev: {e}")
63
+ return None, None
18
64
 
19
65
  def fetch_tokens_from_proxy(proxy_url=None, api_key=None):
20
66
  """
@@ -41,12 +87,12 @@ def fetch_tokens_from_proxy(proxy_url=None, api_key=None):
41
87
  # Check if we have the necessary information
42
88
  if not proxy_url:
43
89
  # print("❌ No proxy URL provided or found in environment")
44
- # print("💡 Set MODAL_PROXY_URL environment variable or use --proxy-url argument")
90
+ print("💡 Set MODAL_PROXY_URL environment variable or use --proxy-url argument")
45
91
  return None, None
46
92
 
47
93
  if not api_key:
48
94
  print("❌ No API key provided or found in environment")
49
- # print("💡 Set MODAL_PROXY_API_KEY environment variable or use --proxy-api-key argument")
95
+ print("💡 Set MODAL_PROXY_API_KEY environment variable or use --proxy-api-key argument")
50
96
  return None, None
51
97
 
52
98
  # Ensure the URL ends with a slash
@@ -94,11 +140,16 @@ def get_tokens():
94
140
  # Try to fetch from the proxy server
95
141
  token_id, token_secret = fetch_tokens_from_proxy()
96
142
 
97
- # If we couldn't fetch from the server, use the default tokens
143
+ # If we couldn't fetch from the server, try to get default tokens from gitarsenal.dev
98
144
  if not token_id or not token_secret:
99
- print("⚠️ Using default tokens")
100
- token_id = DEFAULT_TOKEN_ID
101
- token_secret = DEFAULT_TOKEN_SECRET
145
+ print("⚠️ Proxy server failed, trying to fetch default tokens from gitarsenal.dev")
146
+ token_id, token_secret = fetch_default_tokens_from_gitarsenal()
147
+
148
+ # If we still don't have tokens, we can't proceed
149
+ if not token_id or not token_secret:
150
+ print("❌ Failed to fetch tokens from both proxy server and gitarsenal.dev")
151
+ print("💡 Please check your network connection and API endpoints")
152
+ return None, None
102
153
 
103
154
  # Set the tokens in environment variables
104
155
  os.environ["MODAL_TOKEN_ID"] = token_id
@@ -119,25 +170,25 @@ if __name__ == "__main__":
119
170
  # Set proxy URL and API key in environment variables if provided
120
171
  if args.proxy_url:
121
172
  os.environ["MODAL_PROXY_URL"] = args.proxy_url
122
- # print(f"✅ Set MODAL_PROXY_URL from command line")
173
+ print(f"✅ Set MODAL_PROXY_URL from command line: {args.proxy_url}")
123
174
 
124
175
  if args.proxy_api_key:
125
176
  os.environ["MODAL_PROXY_API_KEY"] = args.proxy_api_key
126
- # print(f"✅ Set MODAL_PROXY_API_KEY from command line")
177
+ print(f"✅ Set MODAL_PROXY_API_KEY from command line")
127
178
 
128
179
  # Get tokens
129
180
  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'))}")
181
+ print(f"Token ID: {token_id}")
182
+ print(f"Token Secret: {token_secret}")
183
+
184
+ # Check if tokens are set in environment variables
185
+ print(f"\n🔍 DEBUG: Checking environment variables")
186
+ print(f"🔍 MODAL_TOKEN_ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
187
+ print(f"🔍 MODAL_TOKEN_SECRET exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
188
+ if os.environ.get('MODAL_TOKEN_ID'):
189
+ print(f"🔍 MODAL_TOKEN_ID length: {len(os.environ.get('MODAL_TOKEN_ID'))}")
190
+ if os.environ.get('MODAL_TOKEN_SECRET'):
191
+ print(f"🔍 MODAL_TOKEN_SECRET length: {len(os.environ.get('MODAL_TOKEN_SECRET'))}")
141
192
 
142
193
  # Write the tokens to a file for use by other scripts
143
194
  tokens_file = Path(__file__).parent / "modal_tokens.json"
@@ -180,4 +231,4 @@ if __name__ == "__main__":
180
231
  except Exception as e:
181
232
  print(f"❌ Error using Modal CLI: {e}")
182
233
 
183
- print(f"\n✅ All token setup completed successfully")
234
+ print(f"\n✅ All token setup completed successfully")
@@ -0,0 +1,8 @@
1
+ {
2
+ "token_id": "ak-sLhYqCjkvixiYcb9LAuCHp",
3
+ "token_secret": "as-fPzD0Zm0dl6IFAEkhaH9pq",
4
+ "openai_api_key": "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",
5
+ "modalTokenId": "ak-sLhYqCjkvixiYcb9LAuCHp",
6
+ "modalTokenSecret": "as-fPzD0Zm0dl6IFAEkhaH9pq",
7
+ "openaiApiKey": "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"
8
+ }
@@ -43,11 +43,16 @@ try:
43
43
  # First, try to import the fetch_modal_tokens module
44
44
  from fetch_modal_tokens import get_tokens
45
45
  TOKEN_ID, TOKEN_SECRET = get_tokens()
46
+
47
+ # Check if we got valid tokens
48
+ if TOKEN_ID is None or TOKEN_SECRET is None:
49
+ raise ValueError("Could not get valid tokens")
50
+
46
51
  print(f"✅ Using tokens from proxy server or defaults")
47
- except ImportError:
48
- # If the module is not available, use hardcoded tokens
49
- # TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
50
- # TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
52
+ except (ImportError, ValueError) as e:
53
+ # If the module is not available or tokens are invalid, use hardcoded tokens
54
+ TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
55
+ TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
51
56
  print(f"⚠️ Using default tokens")
52
57
 
53
58
  print("🔧 Fixing Modal token (basic implementation)...")
@@ -28,6 +28,8 @@ try:
28
28
  except ImportError:
29
29
  # If the module is not available, use hardcoded tokens
30
30
  # print(f"⚠️ Using default tokens")
31
+ TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
32
+ TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq"
31
33
 
32
34
  # print("🔧 Advanced Modal Token Fixer")
33
35
 
@@ -90,10 +92,13 @@ try:
90
92
  )
91
93
 
92
94
  if result.returncode == 0:
95
+ pass
93
96
  # print(f"✅ Successfully set token via Modal CLI")
94
97
  else:
98
+ pass
95
99
  # print(f"❌ Failed to set token via Modal CLI: {result.stderr}")
96
100
  except Exception as e:
101
+ pass
97
102
  # print(f"❌ Error using Modal CLI: {e}")
98
103
 
99
104
  # Approach 4: Use Modal Python API to set token
@@ -0,0 +1,4 @@
1
+ {
2
+ "token_id": "ak-sLhYqCjkvixiYcb9LAuCHp",
3
+ "token_secret": "as-fPzD0Zm0dl6IFAEkhaH9pq"
4
+ }
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test importing and using get_tokens from fetch_modal_tokens
4
+ """
5
+
6
+ import os
7
+ import sys
8
+
9
+ def main():
10
+ """Main function to test importing and using get_tokens"""
11
+ print("🔍 Testing import of get_tokens from fetch_modal_tokens...")
12
+
13
+ # Set a test API key for the script to use
14
+ os.environ["GITARSENAL_API_KEY"] = "test_key"
15
+
16
+ try:
17
+ # Import the function
18
+ from fetch_modal_tokens import get_tokens
19
+ print("✅ Successfully imported get_tokens from fetch_modal_tokens")
20
+
21
+ # Call the function
22
+ print("🔄 Calling get_tokens()...")
23
+ token_id, token_secret = get_tokens()
24
+
25
+ # Check the results
26
+ print("✅ Successfully called get_tokens()")
27
+ print(f" token_id: {token_id[:5]}...{token_id[-5:]}")
28
+ print(f" token_secret: {token_secret[:5]}...{token_secret[-5:]}")
29
+
30
+ # Check if environment variables were set
31
+ if os.environ.get("MODAL_TOKEN_ID") == token_id:
32
+ print("✅ MODAL_TOKEN_ID environment variable set correctly")
33
+ else:
34
+ print("❌ MODAL_TOKEN_ID environment variable not set correctly")
35
+
36
+ if os.environ.get("MODAL_TOKEN_SECRET") == token_secret:
37
+ print("✅ MODAL_TOKEN_SECRET environment variable set correctly")
38
+ else:
39
+ print("❌ MODAL_TOKEN_SECRET environment variable not set correctly")
40
+
41
+ # Check if OPENAI_API_KEY was set
42
+ if os.environ.get("OPENAI_API_KEY"):
43
+ print("✅ OPENAI_API_KEY environment variable set")
44
+ print(f" length: {len(os.environ.get('OPENAI_API_KEY'))}")
45
+ else:
46
+ print("❌ OPENAI_API_KEY environment variable not set")
47
+
48
+ return True
49
+ except Exception as e:
50
+ print(f"❌ Error: {e}")
51
+ return False
52
+
53
+ if __name__ == "__main__":
54
+ success = main()
55
+ sys.exit(0 if success else 1)
@@ -39,6 +39,11 @@ try:
39
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
+
43
+ # Check if we got valid tokens
44
+ if token_id is None or token_secret is None:
45
+ raise ValueError("Could not get valid tokens")
46
+
42
47
  # print(f"✅ Tokens fetched successfully")
43
48
 
44
49
  # Explicitly set the environment variables again to be sure
@@ -19,8 +19,8 @@ try:
19
19
  print(f"✅ Using tokens from proxy server or defaults")
20
20
  except ImportError:
21
21
  # If the module is not available, use hardcoded tokens
22
- TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
23
- TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
22
+ # TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
23
+ # TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
24
24
  print(f"⚠️ Using hardcoded tokens")
25
25
 
26
26
  # Set tokens directly in environment
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Verify that environment variables are set correctly after running fetch_modal_tokens.py
4
+ """
5
+
6
+ import os
7
+ import subprocess
8
+ import sys
9
+
10
+ def check_env_var(var_name):
11
+ """Check if an environment variable is set and print its status"""
12
+ value = os.environ.get(var_name)
13
+ if value:
14
+ print(f"✅ {var_name} is set (length: {len(value)})")
15
+ return True
16
+ else:
17
+ print(f"❌ {var_name} is not set")
18
+ return False
19
+
20
+ def main():
21
+ """Main function to verify environment variables"""
22
+ print("🔍 Checking environment variables before running fetch_modal_tokens.py...")
23
+ modal_id_before = check_env_var("MODAL_TOKEN_ID")
24
+ modal_secret_before = check_env_var("MODAL_TOKEN_SECRET")
25
+ openai_key_before = check_env_var("OPENAI_API_KEY")
26
+
27
+ print("\n🔄 Running fetch_modal_tokens.py...")
28
+ # Set a test API key for the script to use
29
+ os.environ["GITARSENAL_API_KEY"] = "test_key"
30
+
31
+ try:
32
+ # Import the module to run it
33
+ from fetch_modal_tokens import get_tokens
34
+ token_id, token_secret = get_tokens()
35
+ print(f"\n✅ get_tokens() returned values successfully")
36
+ print(f" token_id length: {len(token_id) if token_id else 0}")
37
+ print(f" token_secret length: {len(token_secret) if token_secret else 0}")
38
+ except Exception as e:
39
+ print(f"\n❌ Error running get_tokens(): {e}")
40
+ sys.exit(1)
41
+
42
+ print("\n🔍 Checking environment variables after running fetch_modal_tokens.py...")
43
+ modal_id_after = check_env_var("MODAL_TOKEN_ID")
44
+ modal_secret_after = check_env_var("MODAL_TOKEN_SECRET")
45
+ openai_key_after = check_env_var("OPENAI_API_KEY")
46
+
47
+ # Verify that the variables were set
48
+ if modal_id_after and modal_secret_after:
49
+ print("\n✅ MODAL_TOKEN_ID and MODAL_TOKEN_SECRET were successfully set")
50
+ else:
51
+ print("\n❌ Failed to set all required environment variables")
52
+
53
+ if openai_key_after:
54
+ print("✅ OPENAI_API_KEY was also set")
55
+
56
+ # Check if the values match what was returned by get_tokens()
57
+ if modal_id_after and os.environ.get("MODAL_TOKEN_ID") == token_id:
58
+ print("✅ MODAL_TOKEN_ID matches the value returned by get_tokens()")
59
+
60
+ if modal_secret_after and os.environ.get("MODAL_TOKEN_SECRET") == token_secret:
61
+ print("✅ MODAL_TOKEN_SECRET matches the value returned by get_tokens()")
62
+
63
+ if __name__ == "__main__":
64
+ main()
@@ -1,77 +0,0 @@
1
- # Modal Token Solution
2
-
3
- This directory contains several scripts to solve the Modal token authentication issue. The problem occurs when Modal cannot find or validate the authentication token, resulting in errors like "Token missing" or "Could not authenticate client".
4
-
5
- ## Overview of the Solution
6
-
7
- We've implemented a comprehensive solution that uses multiple approaches to ensure Modal can authenticate properly:
8
-
9
- 1. **fetch_modal_tokens.py**: Fetches tokens from the proxy server.
10
- 2. **modal_token_solution.py**: The main comprehensive solution that combines all approaches.
11
- 3. **modal_auth_patch.py**: A direct patch for Modal's authentication system.
12
- 4. **fix_modal_token.py**: A basic token setup script.
13
- 5. **fix_modal_token_advanced.py**: An advanced version with more approaches.
14
-
15
- ## How It Works
16
-
17
- Our solution uses multiple approaches to ensure Modal authentication works:
18
-
19
- 1. **Token Fetching**: Tries to fetch tokens from the proxy server.
20
- 2. **Environment Variables**: Sets `MODAL_TOKEN_ID` and `MODAL_TOKEN_SECRET` environment variables.
21
- 3. **Token Files**: Creates token files in various formats and locations that Modal might look for.
22
- 4. **Modal CLI**: Attempts to use the Modal CLI to set the token with the correct profile.
23
- 5. **Direct Patching**: Directly patches Modal's authentication system to always return our tokens.
24
- 6. **Monkey Patching**: Monkey-patches Modal's import system to inject our tokens.
25
- 7. **Authentication Testing**: Tests that the authentication works by creating a simple Modal app.
26
-
27
- ## Usage
28
-
29
- The scripts are used in this order of preference:
30
-
31
- 1. First, try `modal_token_solution.py` (most comprehensive)
32
- 2. If that fails, fall back to `modal_auth_patch.py`
33
- 3. If that fails, fall back to `fix_modal_token.py`
34
-
35
- In most cases, you should simply import `modal_token_solution` before importing Modal:
36
-
37
- ```python
38
- import modal_token_solution
39
- import modal
40
-
41
- # Now Modal will use our tokens
42
- ```
43
-
44
- ## Proxy Server Integration
45
-
46
- The solution now integrates with the proxy server to fetch tokens:
47
-
48
- 1. **fetch_modal_tokens.py**: This script fetches tokens from the proxy server using the `MODAL_PROXY_URL` and `MODAL_PROXY_API_KEY` environment variables.
49
- 2. If the proxy server is not available, it falls back to hardcoded tokens.
50
- 3. All other scripts try to use the fetch_modal_tokens module first before falling back to hardcoded tokens.
51
-
52
- ## Troubleshooting
53
-
54
- If you still encounter token issues:
55
-
56
- 1. Check that the tokens are correct (token ID: `ak-sLhYqCjkvixiYcb9LAuCHp`, token secret: `as-fPzD0Zm0dl6IFAEkhaH9pq`).
57
- 2. Verify that the token files are created in the correct locations:
58
- - `~/.modal/token.json`
59
- - `~/.modalconfig`
60
- 3. Check if the proxy server is accessible and returning valid tokens.
61
- 4. Try running the scripts manually to see detailed output.
62
-
63
- ## Implementation Details
64
-
65
- - **Token Values**: We try to fetch tokens from the proxy server, with fallback to hardcoded values.
66
- - **File Locations**: Token files are created in the user's home directory under `~/.modal/`.
67
- - **Patching**: We use Python's dynamic nature to patch Modal's authentication system at runtime.
68
- - **Profile**: We use the `fr8mafia` profile when setting tokens via the CLI.
69
-
70
- ## Files
71
-
72
- - **fetch_modal_tokens.py**: Fetches tokens from the proxy server.
73
- - **modal_token_solution.py**: Comprehensive solution combining all approaches.
74
- - **modal_auth_patch.py**: Direct patch for Modal's authentication system.
75
- - **fix_modal_token.py**: Basic token setup script.
76
- - **fix_modal_token_advanced.py**: Advanced version with more approaches.
77
- - **test_modal_auth.py**: Test script for Modal authentication.
@@ -1,82 +0,0 @@
1
- # Modal Token Setup Solution
2
-
3
- This document explains how the Modal token setup solution works in GitArsenal CLI.
4
-
5
- ## Problem
6
-
7
- The GitArsenal CLI was failing with errors like:
8
-
9
- ```
10
- 🔍 MODAL_TOKEN_ID not found in environment.
11
- ❌ No Modal token found in environment variables
12
- ❌ Modal token file not found
13
- ❌ Could not find Modal token in any location
14
- ```
15
-
16
- This happened because the Modal token was not being properly set in the environment variables.
17
-
18
- ## Solution
19
-
20
- We implemented a comprehensive solution to automatically find and set up the Modal token from various sources:
21
-
22
- 1. Created a `setup_modal_token.py` module that:
23
- - Checks for the token in environment variables (MODAL_TOKEN_ID and MODAL_TOKEN)
24
- - Checks for the token in GitArsenal credentials file (~/.gitarsenal/credentials.json)
25
- - Checks for the token in Modal token file (~/.modal/token.json)
26
- - Sets the token in both MODAL_TOKEN_ID and MODAL_TOKEN environment variables
27
-
28
- 2. Modified key files to use this module:
29
- - `gitarsenal.py` - Main CLI entry point
30
- - `modal_proxy_service.py` - Modal proxy service
31
- - `test_modalSandboxScript.py` - Modal sandbox script
32
-
33
- 3. Created a wrapper script `run_with_modal_token.py` that:
34
- - Sets up the Modal token using the setup_modal_token module
35
- - Runs a specified command with the token properly set in the environment
36
-
37
- ## Usage
38
-
39
- ### Running Commands with Modal Token
40
-
41
- Use the wrapper script to run any command that requires Modal authentication:
42
-
43
- ```bash
44
- python run_with_modal_token.py <command> [args...]
45
- ```
46
-
47
- Example:
48
-
49
- ```bash
50
- python run_with_modal_token.py python modal_proxy_service.py
51
- ```
52
-
53
- ### Setting Up Modal Token
54
-
55
- If you need to set up the Modal token manually:
56
-
57
- ```bash
58
- python setup_modal_token.py
59
- ```
60
-
61
- This will prompt you for the token if it's not found in any of the sources.
62
-
63
- ### Adding Modal Token to GitArsenal Credentials
64
-
65
- You can also add the Modal token to GitArsenal credentials:
66
-
67
- ```bash
68
- ./gitarsenal.py credentials set modal_token
69
- ```
70
-
71
- ## How It Works
72
-
73
- 1. The `setup_modal_token.py` module checks multiple sources for the Modal token:
74
- - Environment variables (MODAL_TOKEN_ID and MODAL_TOKEN)
75
- - GitArsenal credentials file (~/.gitarsenal/credentials.json)
76
- - Modal token file (~/.modal/token.json)
77
-
78
- 2. When it finds a token, it sets both MODAL_TOKEN_ID and MODAL_TOKEN environment variables.
79
-
80
- 3. The modified files import and use this module to ensure the token is set before any Modal operations.
81
-
82
- 4. The wrapper script makes it easy to run any command with the token properly set up.