gitarsenal-cli 1.7.9 → 1.8.2

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/README.md CHANGED
@@ -18,26 +18,26 @@ GitArsenal CLI makes it incredibly easy to run any GitHub repository without wor
18
18
 
19
19
  ```bash
20
20
  # Basic usage - clone and run any repo
21
- gitarsenal container --repo-url https://github.com/username/awesome-project.git
21
+ gitarsenal --repo-url https://github.com/username/awesome-project.git
22
22
 
23
23
  # With GPU acceleration
24
- gitarsenal container --gpu A10G --repo-url https://github.com/username/awesome-project.git
24
+ gitarsenal --gpu A10G --repo-url https://github.com/username/awesome-project.git
25
25
 
26
26
  # With custom setup commands
27
- gitarsenal container --gpu A100 --repo-url https://github.com/username/awesome-project.git --setup-commands "pip install -r requirements.txt" "python setup.py install"
27
+ gitarsenal --gpu A100 --repo-url https://github.com/username/awesome-project.git --setup-commands "pip install -r requirements.txt" "python setup.py install"
28
28
  ```
29
29
 
30
30
  ### Examples
31
31
 
32
32
  ```bash
33
33
  # Run a machine learning project
34
- gitarsenal container --gpu A100 --repo-url https://github.com/username/transformer-project.git --setup-commands "pip install torch transformers" "wandb login"
34
+ gitarsenal --gpu A100 --repo-url https://github.com/username/transformer-project.git --setup-commands "pip install torch transformers" "wandb login"
35
35
 
36
36
  # Run a web development project
37
- gitarsenal container --repo-url https://github.com/username/react-app.git --setup-commands "npm install" "npm start"
37
+ gitarsenal --repo-url https://github.com/username/react-app.git --setup-commands "npm install" "npm start"
38
38
 
39
39
  # Run a data science project with persistent storage
40
- gitarsenal container --gpu A10G --repo-url https://github.com/username/data-analysis.git --volume-name my-data --setup-commands "pip install pandas numpy matplotlib"
40
+ gitarsenal --gpu A10G --repo-url https://github.com/username/data-analysis.git --volume-name my-data --setup-commands "pip install pandas numpy matplotlib"
41
41
  ```
42
42
 
43
43
  ## API Key Management
@@ -78,7 +78,7 @@ Keep your work safe with persistent volumes:
78
78
 
79
79
  ```bash
80
80
  # Create a persistent environment
81
- gitarsenal container --repo-url https://github.com/username/project.git --volume-name my-work
81
+ gitarsenal --repo-url https://github.com/username/project.git --volume-name my-work
82
82
 
83
83
  # Your data, models, and work will persist between sessions
84
84
  ```
@@ -88,7 +88,7 @@ Connect directly to your running environment:
88
88
 
89
89
  ```bash
90
90
  # Get SSH connection details
91
- gitarsenal container --repo-url https://github.com/username/project.git --ssh
91
+ gitarsenal --repo-url https://github.com/username/project.git --ssh
92
92
 
93
93
  # Connect via SSH to your environment
94
94
  ssh user@your-environment-ip
@@ -113,7 +113,7 @@ ssh user@your-environment-ip
113
113
 
114
114
  1. Install the CLI (see installation instructions)
115
115
  2. Add your API keys: `gitarsenal keys add --service openai`
116
- 3. Run any repository: `gitarsenal container --repo-url https://github.com/username/project.git`
116
+ 3. Run any repository: `gitarsenal --repo-url https://github.com/username/project.git`
117
117
  4. Start coding!
118
118
 
119
119
  No more "works on my machine" - every environment is identical and ready to go.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.7.9",
3
+ "version": "1.8.2",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -38,7 +38,7 @@ if args.proxy_api_key:
38
38
  class PersistentShell:
39
39
  """A persistent bash shell using subprocess.Popen for executing commands with state persistence."""
40
40
 
41
- def __init__(self, working_dir="/root", timeout=200):
41
+ def __init__(self, working_dir="/root", timeout=240):
42
42
  self.working_dir = working_dir
43
43
  self.timeout = timeout
44
44
  self.process = None
@@ -197,7 +197,7 @@ class PersistentShell:
197
197
 
198
198
  # Wait for shell to be ready (prompt should be visible)
199
199
  if not self.wait_for_prompt(timeout=2):
200
- print("⚠️ Shell not ready, waiting...")
200
+ # print("⚠️ Shell not ready, waiting...")
201
201
  time.sleep(0.5)
202
202
 
203
203
  # For source commands, we need special handling
@@ -1788,7 +1788,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1788
1788
  cmd_manager = CommandListManager(setup_commands)
1789
1789
 
1790
1790
  # Create persistent shell instance starting in /root
1791
- shell = PersistentShell(working_dir="/root", timeout=200)
1791
+ shell = PersistentShell(working_dir="/root", timeout=240)
1792
1792
 
1793
1793
  try:
1794
1794
  # Start the persistent shell
@@ -1812,7 +1812,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1812
1812
  print(f"📋 Executing main command {cmd_index + 1}/{cmd_manager.total_commands}: {cmd_text}")
1813
1813
 
1814
1814
  start_time = time.time()
1815
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1815
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1816
1816
  execution_time = time.time() - start_time
1817
1817
 
1818
1818
  # Mark command as executed
@@ -1840,7 +1840,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1840
1840
  # Execute the fix command
1841
1841
  print(f"🔄 Running suggested fix command: {fix_command}")
1842
1842
  fix_start_time = time.time()
1843
- fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=200)
1843
+ fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=240)
1844
1844
  fix_execution_time = time.time() - fix_start_time
1845
1845
 
1846
1846
  # Mark fix command as executed
@@ -1854,7 +1854,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1854
1854
  # Retry the original command
1855
1855
  print(f"🔄 Retrying original command: {cmd_text}")
1856
1856
  retry_start_time = time.time()
1857
- retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=200)
1857
+ retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=240)
1858
1858
  retry_execution_time = time.time() - retry_start_time
1859
1859
 
1860
1860
  # Update the original command status
@@ -1883,7 +1883,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1883
1883
  print(f"🔧 Executing fix command {cmd_index + 1}: {cmd_text}")
1884
1884
 
1885
1885
  start_time = time.time()
1886
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1886
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1887
1887
  execution_time = time.time() - start_time
1888
1888
 
1889
1889
  # Mark fix command as executed
@@ -1911,7 +1911,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1911
1911
  print(f"🔧 Executing additional fix: {cmd_text}")
1912
1912
 
1913
1913
  start_time = time.time()
1914
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1914
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1915
1915
  execution_time = time.time() - start_time
1916
1916
 
1917
1917
  # Mark fix command as executed
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test script to verify that stored credentials are being passed correctly to SSH containers.
4
+ """
5
+
6
+ import os
7
+ import json
8
+ from pathlib import Path
9
+
10
+ def test_credentials_loading():
11
+ """Test that credentials can be loaded from the local file"""
12
+ print("🔍 Testing credentials loading...")
13
+
14
+ # Test get_stored_credentials function
15
+ try:
16
+ from test_modalSandboxScript import get_stored_credentials
17
+ credentials = get_stored_credentials()
18
+
19
+ if credentials:
20
+ print(f"✅ Found {len(credentials)} stored credentials:")
21
+ for key, value in credentials.items():
22
+ masked_value = value[:8] + "..." if len(value) > 8 else "***"
23
+ print(f" - {key}: {masked_value}")
24
+ else:
25
+ print("⚠️ No stored credentials found")
26
+
27
+ return credentials
28
+ except Exception as e:
29
+ print(f"❌ Error loading credentials: {e}")
30
+ return {}
31
+
32
+ def test_credentials_file():
33
+ """Test that the credentials file exists and is readable"""
34
+ print("\n🔍 Testing credentials file...")
35
+
36
+ credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
37
+
38
+ if credentials_file.exists():
39
+ print(f"✅ Credentials file exists at: {credentials_file}")
40
+ try:
41
+ with open(credentials_file, 'r') as f:
42
+ credentials = json.load(f)
43
+ print(f"✅ Successfully loaded {len(credentials)} credentials from file")
44
+ return credentials
45
+ except Exception as e:
46
+ print(f"❌ Error reading credentials file: {e}")
47
+ return {}
48
+ else:
49
+ print(f"⚠️ Credentials file not found at: {credentials_file}")
50
+ print("💡 You can create it by running the credentials manager")
51
+ return {}
52
+
53
+ def test_environment_variables():
54
+ """Test that credentials are available as environment variables"""
55
+ print("\n🔍 Testing environment variables...")
56
+
57
+ credential_env_vars = [
58
+ 'OPENAI_API_KEY', 'WANDB_API_KEY', 'HF_TOKEN', 'HUGGINGFACE_TOKEN',
59
+ 'GITHUB_TOKEN', 'KAGGLE_USERNAME', 'KAGGLE_KEY'
60
+ ]
61
+
62
+ found_creds = {}
63
+ for env_var in credential_env_vars:
64
+ value = os.environ.get(env_var)
65
+ if value:
66
+ found_creds[env_var] = value
67
+ masked_value = value[:8] + "..." if len(value) > 8 else "***"
68
+ print(f"✅ {env_var}: {masked_value}")
69
+
70
+ if not found_creds:
71
+ print("⚠️ No credential environment variables found")
72
+
73
+ return found_creds
74
+
75
+ def test_credentials_integration():
76
+ """Test the full credentials integration"""
77
+ print("\n" + "="*60)
78
+ print("🔐 CREDENTIALS INTEGRATION TEST")
79
+ print("="*60)
80
+
81
+ # Test all credential sources
82
+ file_creds = test_credentials_file()
83
+ env_creds = test_environment_variables()
84
+ function_creds = test_credentials_loading()
85
+
86
+ # Combine all credentials
87
+ all_creds = {}
88
+ all_creds.update(file_creds)
89
+ all_creds.update(env_creds)
90
+ all_creds.update(function_creds)
91
+
92
+ print(f"\n📊 SUMMARY:")
93
+ print(f" - File credentials: {len(file_creds)}")
94
+ print(f" - Environment credentials: {len(env_creds)}")
95
+ print(f" - Function credentials: {len(function_creds)}")
96
+ print(f" - Total unique credentials: {len(all_creds)}")
97
+
98
+ if all_creds:
99
+ print(f"\n✅ Credentials are available for SSH container integration")
100
+ print("💡 These credentials will be automatically passed to SSH containers")
101
+ else:
102
+ print(f"\n⚠️ No credentials found")
103
+ print("💡 Consider setting up credentials using the credentials manager")
104
+
105
+ return all_creds
106
+
107
+ if __name__ == "__main__":
108
+ test_credentials_integration()
@@ -38,7 +38,7 @@ if args.proxy_api_key:
38
38
  class PersistentShell:
39
39
  """A persistent bash shell using subprocess.Popen for executing commands with state persistence."""
40
40
 
41
- def __init__(self, working_dir="/root", timeout=200):
41
+ def __init__(self, working_dir="/root", timeout=240):
42
42
  self.working_dir = working_dir
43
43
  self.timeout = timeout
44
44
  self.process = None
@@ -197,7 +197,7 @@ class PersistentShell:
197
197
 
198
198
  # Wait for shell to be ready (prompt should be visible)
199
199
  if not self.wait_for_prompt(timeout=2):
200
- print("⚠️ Shell not ready, waiting...")
200
+ # print("⚠️ Shell not ready, waiting...")
201
201
  time.sleep(0.5)
202
202
 
203
203
  # For source commands, we need special handling
@@ -1788,7 +1788,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1788
1788
  cmd_manager = CommandListManager(setup_commands)
1789
1789
 
1790
1790
  # Create persistent shell instance starting in /root
1791
- shell = PersistentShell(working_dir="/root", timeout=200)
1791
+ shell = PersistentShell(working_dir="/root", timeout=240)
1792
1792
 
1793
1793
  try:
1794
1794
  # Start the persistent shell
@@ -1812,7 +1812,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1812
1812
  print(f"📋 Executing main command {cmd_index + 1}/{cmd_manager.total_commands}: {cmd_text}")
1813
1813
 
1814
1814
  start_time = time.time()
1815
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1815
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1816
1816
  execution_time = time.time() - start_time
1817
1817
 
1818
1818
  # Mark command as executed
@@ -1840,7 +1840,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1840
1840
  # Execute the fix command
1841
1841
  print(f"🔄 Running suggested fix command: {fix_command}")
1842
1842
  fix_start_time = time.time()
1843
- fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=200)
1843
+ fix_success, fix_stdout, fix_stderr = shell.execute(fix_command, timeout=240)
1844
1844
  fix_execution_time = time.time() - fix_start_time
1845
1845
 
1846
1846
  # Mark fix command as executed
@@ -1854,7 +1854,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1854
1854
  # Retry the original command
1855
1855
  print(f"🔄 Retrying original command: {cmd_text}")
1856
1856
  retry_start_time = time.time()
1857
- retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=200)
1857
+ retry_success, retry_stdout, retry_stderr = shell.execute(cmd_text, timeout=240)
1858
1858
  retry_execution_time = time.time() - retry_start_time
1859
1859
 
1860
1860
  # Update the original command status
@@ -1883,7 +1883,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1883
1883
  print(f"🔧 Executing fix command {cmd_index + 1}: {cmd_text}")
1884
1884
 
1885
1885
  start_time = time.time()
1886
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1886
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1887
1887
  execution_time = time.time() - start_time
1888
1888
 
1889
1889
  # Mark fix command as executed
@@ -1911,7 +1911,7 @@ def create_modal_ssh_container(gpu_type, repo_url=None, repo_name=None, setup_co
1911
1911
  print(f"🔧 Executing additional fix: {cmd_text}")
1912
1912
 
1913
1913
  start_time = time.time()
1914
- success, stdout, stderr = shell.execute(cmd_text, timeout=200)
1914
+ success, stdout, stderr = shell.execute(cmd_text, timeout=240)
1915
1915
  execution_time = time.time() - start_time
1916
1916
 
1917
1917
  # Mark fix command as executed