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.
@@ -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 Modal 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"✅ Modal 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"🔍 MODAL_TOKEN_ID exists: {'Yes' if os.environ.get('MODAL_TOKEN_ID') else 'No'}")
120
- print(f"🔍 MODAL_TOKEN_SECRET exists: {'Yes' if os.environ.get('MODAL_TOKEN_SECRET') else 'No'}")
121
- print(f"🔍 MODAL_TOKEN exists: {'Yes' if os.environ.get('MODAL_TOKEN') else 'No'}")
122
- if os.environ.get('MODAL_TOKEN_ID'):
123
- print(f"🔍 MODAL_TOKEN_ID length: {len(os.environ.get('MODAL_TOKEN_ID'))}")
124
- if os.environ.get('MODAL_TOKEN_SECRET'):
125
- print(f"🔍 MODAL_TOKEN_SECRET length: {len(os.environ.get('MODAL_TOKEN_SECRET'))}")
126
- if os.environ.get('MODAL_TOKEN'):
127
- print(f"🔍 MODAL_TOKEN length: {len(os.environ.get('MODAL_TOKEN'))}")
128
- print(f"✅ Modal 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
@@ -604,12 +604,12 @@ def create_modal_sandbox(gpu_type, repo_url=None, repo_name=None, setup_commands
604
604
  try:
605
605
  # This will raise an exception if not authenticated
606
606
  modal.config.get_current_workspace_name()
607
- print("✅ Modal authentication verified")
607
+ print("✅ Authentication verified")
608
608
  except modal.exception.AuthError:
609
609
  print("\n" + "="*80)
610
- print("🔑 MODAL AUTHENTICATION REQUIRED")
610
+ print("🔑 AUTHENTICATION REQUIRED")
611
611
  print("="*80)
612
- print("GitArsenal requires Modal authentication to create cloud environments.")
612
+ print("GitArsenal requires authentication to create cloud environments.")
613
613
 
614
614
  # Try to get token from credentials manager
615
615
  modal_token = None
@@ -703,7 +703,7 @@ def create_modal_sandbox(gpu_type, repo_url=None, repo_name=None, setup_commands
703
703
  gpu_type = 'A10G'
704
704
 
705
705
  gpu_spec = gpu_configs[gpu_type]
706
- print(f"🚀 Creating Modal sandbox with {gpu_spec['gpu']} GPU ({gpu_spec['memory']}GB VRAM)")
706
+ print(f"🚀 Creating sandbox with {gpu_spec['gpu']} GPU ({gpu_spec['memory']}GB VRAM)")
707
707
 
708
708
  # Initialize uv_path variable
709
709
  uv_path = ""
@@ -738,7 +738,7 @@ def create_modal_sandbox(gpu_type, repo_url=None, repo_name=None, setup_commands
738
738
  # Enable output for image building
739
739
  with modal.enable_output():
740
740
  # Create a Modal app and sandbox
741
- print(f"🚀 Creating Modal sandbox with GPU: {gpu_type.lower()} (App: {app_name})...")
741
+ print(f"🚀 Creating sandbox with GPU: {gpu_type.lower()} (App: {app_name})...")
742
742
  # Always use lookup with create_if_missing=True to properly initialize the app
743
743
  app = modal.App.lookup(app_name, create_if_missing=True)
744
744
  print(f"Created app: {app_name}")
@@ -947,7 +947,7 @@ def create_modal_sandbox(gpu_type, repo_url=None, repo_name=None, setup_commands
947
947
  return str(maybe_bytes)
948
948
 
949
949
  # Skip the persistent shell approach for now due to async stream complexity
950
- print("🔍 Modal's async streams require complex async handling")
950
+ print("🔍 async streams require complex async handling")
951
951
  print("🔄 Switching to individual command execution approach for reliability...")
952
952
 
953
953
  # Initialize state tracking variables
@@ -2013,7 +2013,7 @@ cd "{current_dir}"
2013
2013
  f.write(container_id)
2014
2014
 
2015
2015
  # Print connection instructions
2016
- print(f"✅ Modal sandbox created successfully!")
2016
+ print(f"✅ Sandbox created successfully!")
2017
2017
  print(f"📋 Sandbox ID: {sandbox_id}")
2018
2018
  print(f"📋 Container ID: {container_id}")
2019
2019
  if volume:
@@ -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 container
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
@@ -2246,12 +2246,12 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2246
2246
  print("🔍 DEBUG: Checking environment variables")
2247
2247
  modal_token_id = os.environ.get("MODAL_TOKEN_ID")
2248
2248
  modal_token = os.environ.get("MODAL_TOKEN")
2249
- print(f"🔍 MODAL_TOKEN_ID exists: {'Yes' if modal_token_id else 'No'}")
2250
- print(f"🔍 MODAL_TOKEN exists: {'Yes' if modal_token else 'No'}")
2249
+ print(f"🔍 token exists: {'Yes' if modal_token_id else 'No'}")
2250
+ print(f"🔍 token exists: {'Yes' if modal_token else 'No'}")
2251
2251
  if modal_token_id:
2252
- print(f"🔍 MODAL_TOKEN_ID length: {len(modal_token_id)}")
2252
+ print(f"🔍 token length: {len(modal_token_id)}")
2253
2253
  if modal_token:
2254
- print(f"🔍 MODAL_TOKEN length: {len(modal_token)}")
2254
+ print(f"🔍 token length: {len(modal_token)}")
2255
2255
 
2256
2256
  # Try to access Modal token to check authentication
2257
2257
  try:
@@ -2262,13 +2262,13 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2262
2262
  # Try to get from MODAL_TOKEN
2263
2263
  modal_token = os.environ.get("MODAL_TOKEN")
2264
2264
  if modal_token:
2265
- print("✅ Found token in MODAL_TOKEN environment variable")
2265
+ print("✅ Found token in environment variable")
2266
2266
  os.environ["MODAL_TOKEN_ID"] = modal_token
2267
2267
  modal_token_id = modal_token
2268
- print(f"✅ Set MODAL_TOKEN_ID from MODAL_TOKEN (length: {len(modal_token)})")
2268
+ print(f"✅ Set token (length: {len(modal_token)})")
2269
2269
 
2270
2270
  if modal_token_id:
2271
- print(f"✅ Modal token found (length: {len(modal_token_id)})")
2271
+ print(f"✅ token found (length: {len(modal_token_id)})")
2272
2272
 
2273
2273
  # Use the comprehensive fix_modal_token script
2274
2274
  try:
@@ -2289,11 +2289,11 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2289
2289
  if result.stderr:
2290
2290
  print(f"Error: {result.stderr}")
2291
2291
 
2292
- print(f"✅ Modal token setup completed")
2292
+ print(f"✅ token setup completed")
2293
2293
  except Exception as e:
2294
2294
  print(f"⚠️ Error running fix_modal_token.py: {e}")
2295
2295
  else:
2296
- print("❌ No Modal token found in environment variables")
2296
+ print("❌ No token found in environment variables")
2297
2297
  # Try to get from file as a last resort
2298
2298
  try:
2299
2299
  home_dir = os.path.expanduser("~")
@@ -2312,7 +2312,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2312
2312
  else:
2313
2313
  print("❌ Token file does not contain token_id")
2314
2314
  else:
2315
- print("❌ Modal token file not found")
2315
+ print("❌ token file not found")
2316
2316
  except Exception as e:
2317
2317
  print(f"❌ Error loading token from file: {e}")
2318
2318
 
@@ -2326,9 +2326,9 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2326
2326
  modal_token_id = os.environ.get("MODAL_TOKEN_ID")
2327
2327
  modal_token = os.environ.get("MODAL_TOKEN")
2328
2328
  if modal_token_id:
2329
- print(f"🔄 Using MODAL_TOKEN_ID from environment (length: {len(modal_token_id)})")
2329
+ print(f"🔄 Using token from environment (length: {len(modal_token_id)})")
2330
2330
  elif modal_token:
2331
- print(f"🔄 Using MODAL_TOKEN from environment (length: {len(modal_token)})")
2331
+ print(f"🔄 Using token from environment (length: {len(modal_token)})")
2332
2332
  os.environ["MODAL_TOKEN_ID"] = modal_token
2333
2333
  modal_token_id = modal_token
2334
2334
  else:
@@ -2338,7 +2338,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2338
2338
  # Set it in both environment variables
2339
2339
  os.environ["MODAL_TOKEN_ID"] = modal_token_id
2340
2340
  os.environ["MODAL_TOKEN"] = modal_token_id
2341
- print("✅ Set both MODAL_TOKEN_ID and MODAL_TOKEN environment variables")
2341
+ print("✅ Set both token and id environment variables")
2342
2342
  except Exception as e:
2343
2343
  print(f"⚠️ Error checking Modal authentication: {e}")
2344
2344
  print("Continuing anyway, but Modal operations may fail")
@@ -2364,7 +2364,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2364
2364
  gpu_type = 'A10G'
2365
2365
 
2366
2366
  gpu_spec = gpu_configs[gpu_type]
2367
- print(f"🚀 Creating Modal SSH container with {gpu_spec['gpu']} GPU ({gpu_spec['memory']}GB VRAM)")
2367
+ print(f"🚀 Creating SSH container with {gpu_spec['gpu']} GPU ({gpu_spec['memory']}GB VRAM)")
2368
2368
 
2369
2369
  # Generate or use provided SSH password
2370
2370
  if not ssh_password:
@@ -2400,16 +2400,16 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
2400
2400
  # Print debug info for authentication
2401
2401
  print("🔍 Modal authentication debug info:")
2402
2402
  modal_token = os.environ.get("MODAL_TOKEN_ID")
2403
- print(f" - MODAL_TOKEN_ID in env: {'Yes' if modal_token else 'No'}")
2403
+ print(f" - token in env: {'Yes' if modal_token else 'No'}")
2404
2404
  print(f" - Token length: {len(modal_token) if modal_token else 'N/A'}")
2405
2405
 
2406
2406
  # Verify we can create a Modal app
2407
2407
  try:
2408
- print("🔍 Testing Modal app creation...")
2408
+ print("🔍 Testing app creation...")
2409
2409
  app = modal.App(app_name)
2410
- print("✅ Created Modal app successfully")
2410
+ print("✅ Created app successfully")
2411
2411
  except Exception as e:
2412
- print(f"❌ Error creating Modal app: {e}")
2412
+ print(f"❌ Error creating app: {e}")
2413
2413
  return None
2414
2414
 
2415
2415
  # Create SSH-enabled image
@@ -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 - note that the default format might not be JSON
2621
+ # Read the output file - GitIngest outputs structured text, not JSON
2622
2622
  try:
2623
- # First try to parse as JSON
2624
- try:
2625
- with open(output_file, 'r', encoding='utf-8') as f:
2626
- content = f.read()
2627
- try:
2628
- gitingest_data = json.loads(content)
2629
- print(f"✅ GitIngest data loaded as JSON from {output_file}")
2630
- except json.JSONDecodeError:
2631
- # If not JSON, convert the text output to a basic structure
2632
- print(f"⚠️ GitIngest output is not in JSON format, converting text to structure")
2633
- gitingest_data = {
2634
- "system_info": {
2635
- "detected_language": "Unknown",
2636
- "detected_technologies": [],
2637
- },
2638
- "repository_analysis": {
2639
- "summary": content[:5000], # First 5000 chars as summary
2640
- "content_preview": content[:10000] # First 10000 chars as preview
2641
- },
2642
- "success": True
2643
- }
2644
- except FileNotFoundError:
2645
- print(f"⚠️ Output file not found at {output_file}")
2646
- gitingest_data = generate_basic_repo_analysis_from_url(repo_url)
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=60)
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
- # Return fallback commands
2712
- return generate_fallback_commands(gitingest_data)
2713
- except json.JSONDecodeError as e:
2714
- print(f" Failed to parse API response as JSON: {e}")
2715
- print(f"Raw response: {response.text[:500]}...")
2716
- # Return fallback commands
2717
- return generate_fallback_commands(gitingest_data)
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
- # Return fallback commands
2722
- return generate_fallback_commands(gitingest_data)
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: {response.status_code}")
2725
- print(f"Error response: {response.text[:500]}...")
2726
- # Return fallback commands
2727
- return generate_fallback_commands(gitingest_data)
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 60 seconds")
2730
- print("⚠️ Using fallback commands instead")
2731
- # Return fallback commands
2732
- return generate_fallback_commands(gitingest_data)
2733
- except requests.exceptions.ConnectionError:
2734
- print(f" Connection error: Could not connect to {api_url}")
2735
- print("⚠️ Using fallback commands instead")
2736
- # Return fallback commands
2737
- return generate_fallback_commands(gitingest_data)
2738
- except Exception as e:
2739
- print(f"❌ Error fetching setup commands from API: {e}")
2740
- import traceback
2741
- traceback.print_exc()
2742
- # Return fallback commands
2743
- return generate_fallback_commands(None)
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 the temporary directory
2772
+ # Clean up temporary directory
2746
2773
  print(f"🧹 Cleaning up temporary directory...")
2747
- shutil.rmtree(temp_dir, ignore_errors=True)
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"""
@@ -3302,33 +3339,33 @@ Respond with only 'NAVIGATE' if navigation makes sense, or 'SKIP' if it's redund
3302
3339
  return None
3303
3340
 
3304
3341
  def cleanup_modal_token():
3305
- """Delete Modal token files and environment variables after SSH container is started"""
3306
- print("🧹 Cleaning up Modal token for security...")
3342
+ """Delete token files and environment variables after SSH container is started"""
3343
+ print("🧹 Cleaning up tokens for security...")
3307
3344
 
3308
3345
  try:
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 MODAL_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 MODAL_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 MODAL_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 Modal token file at {modal_toml}")
3364
+ # print(f"✅ Deleted token file at {modal_toml}")
3328
3365
 
3329
- print("✅ Modal token cleanup completed successfully")
3366
+ # print("✅ Token cleanup completed successfully")
3330
3367
  except Exception as e:
3331
- print(f"❌ Error during Modal token cleanup: {e}")
3368
+ print(f"❌ Error during token cleanup: {e}")
3332
3369
 
3333
3370
  def show_usage_examples():
3334
3371
  """Display usage examples for the script."""
@@ -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())