gitarsenal-cli 1.1.1 → 1.1.3

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.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
package/python/README.md CHANGED
@@ -13,50 +13,51 @@ cd gitarsenal-cli/python
13
13
  pip install -r requirements.txt
14
14
  ```
15
15
 
16
- ## Credentials Setup
16
+ ## First-Time Setup
17
17
 
18
- GitArsenal CLI requires several API keys and tokens to function properly:
18
+ Before using GitArsenal CLI, you need to set up your credentials and authenticate with Modal:
19
19
 
20
- - **OpenAI API Key**: Used for debugging failed commands
21
- - **Modal Token**: Used to create cloud environments
22
- - **Hugging Face Token**: Used for accessing Hugging Face models
23
- - **Weights & Biases API Key**: Used for experiment tracking
24
-
25
- You can set up your credentials using the credentials manager:
20
+ ### 1. Install Modal
26
21
 
27
22
  ```bash
28
- python manage_credentials.py setup
23
+ pip install modal
29
24
  ```
30
25
 
31
- This will guide you through setting up all required credentials, which will be stored securely in your home directory.
26
+ ### 2. Create a Modal Account and Get a Token
32
27
 
33
- ### Managing Individual Credentials
28
+ If you don't have a Modal account:
29
+ 1. Go to https://modal.com and create an account
30
+ 2. Run the following command to authenticate:
31
+ ```bash
32
+ modal token new
33
+ ```
34
+ 3. Follow the instructions to complete authentication
34
35
 
35
- You can also manage individual credentials:
36
+ ### 3. Set Up GitArsenal Credentials
36
37
 
37
38
  ```bash
38
- # Set a specific credential
39
- python manage_credentials.py set openai_api_key
39
+ # Set up all required credentials
40
+ ./gitarsenal.py credentials setup
41
+ ```
40
42
 
41
- # View a credential (masked for security)
42
- python manage_credentials.py get modal_token
43
+ This will guide you through setting up:
44
+ - **Modal Token**: Required for creating cloud environments
45
+ - **OpenAI API Key**: Used for debugging failed commands (optional)
46
+ - **Hugging Face Token**: Used for accessing Hugging Face models (optional)
47
+ - **Weights & Biases API Key**: Used for experiment tracking (optional)
43
48
 
44
- # Clear a specific credential
45
- python manage_credentials.py clear huggingface_token
49
+ ## Usage
46
50
 
47
- # Clear all credentials
48
- python manage_credentials.py clear
51
+ ### Creating a Modal Sandbox
49
52
 
50
- # List all saved credentials (without showing values)
51
- python manage_credentials.py list
53
+ ```bash
54
+ ./gitarsenal.py sandbox --gpu A10G --repo-url "https://github.com/username/repo.git"
52
55
  ```
53
56
 
54
- ## Usage
55
-
56
- ### Creating a Modal Sandbox
57
+ ### Creating an SSH Container
57
58
 
58
59
  ```bash
59
- python test_modalSandboxScript.py --gpu A10G --repo-url "https://github.com/username/repo.git"
60
+ ./gitarsenal.py ssh --gpu A10G --repo-url "https://github.com/username/repo.git"
60
61
  ```
61
62
 
62
63
  ### Options
@@ -66,30 +67,192 @@ python test_modalSandboxScript.py --gpu A10G --repo-url "https://github.com/user
66
67
  - `--repo-name`: Repository name override
67
68
  - `--setup-commands`: Setup commands to run
68
69
  - `--volume-name`: Name of the Modal volume for persistent storage
70
+ - `--timeout`: Container timeout in minutes (SSH mode only, default: 60)
71
+ - `--use-proxy`: Use Modal proxy service instead of direct Modal access
72
+
73
+ ## Using the Modal Proxy Service
74
+
75
+ GitArsenal CLI now supports using a Modal proxy service, which allows you to use Modal services without having your own Modal token. This is useful for teams or organizations where a single Modal account is shared.
76
+
77
+ ### Setting Up the Proxy Service
78
+
79
+ #### 1. Create an Environment File
80
+
81
+ Copy the example environment file and edit it:
82
+
83
+ ```bash
84
+ cp .env.example .env
85
+ ```
86
+
87
+ Edit the `.env` file to add your Modal token:
88
+
89
+ ```
90
+ MODAL_TOKEN=your_modal_token_here
91
+ ```
92
+
93
+ #### 2. Run the Proxy Service
94
+
95
+ ```bash
96
+ # Start the proxy service
97
+ python modal_proxy_service.py
98
+ ```
99
+
100
+ The service will start on port 5001 by default (to avoid conflicts with macOS AirPlay on port 5000).
101
+
102
+ #### 3. Create an API Key for Clients
103
+
104
+ When the service starts for the first time, it will generate an admin key. Use this key to create API keys for clients:
105
+
106
+ ```bash
107
+ # Create a new API key
108
+ curl -X POST -H "X-Admin-Key: your_admin_key" http://localhost:5001/api/create-api-key
109
+ ```
110
+
111
+ #### 4. Using ngrok for Public Access (Optional)
112
+
113
+ If you want to make your proxy service accessible from outside your network:
114
+
115
+ ```bash
116
+ # Install ngrok if you haven't already
117
+ brew install ngrok # On macOS
118
+
119
+ # Start ngrok to expose your proxy service
120
+ ngrok http 5001
121
+ ```
122
+
123
+ Use the ngrok URL when configuring clients.
124
+
125
+ ### Configuring the Client
126
+
127
+ ```bash
128
+ # Configure the proxy service
129
+ ./gitarsenal.py proxy configure
130
+ ```
131
+
132
+ This will prompt you for the proxy service URL and API key.
133
+
134
+ ### Checking Proxy Service Status
135
+
136
+ ```bash
137
+ # Check if the proxy service is running
138
+ ./gitarsenal.py proxy status
139
+ ```
140
+
141
+ ### Creating a Sandbox through the Proxy
142
+
143
+ ```bash
144
+ # Create a sandbox through the proxy service
145
+ ./gitarsenal.py proxy sandbox --gpu A10G --repo-url "https://github.com/username/repo.git" --wait
146
+ ```
147
+
148
+ ### Creating an SSH Container through the Proxy
149
+
150
+ ```bash
151
+ # Create an SSH container through the proxy service
152
+ ./gitarsenal.py proxy ssh --gpu A10G --repo-url "https://github.com/username/repo.git" --wait
153
+ ```
154
+
155
+ ### Using the Proxy with Standard Commands
156
+
157
+ You can also use the proxy service with the standard `sandbox` and `ssh` commands by adding the `--use-proxy` flag:
158
+
159
+ ```bash
160
+ # Create a sandbox using the proxy service
161
+ ./gitarsenal.py sandbox --gpu A10G --repo-url "https://github.com/username/repo.git" --use-proxy
162
+
163
+ # Create an SSH container using the proxy service
164
+ ./gitarsenal.py ssh --gpu A10G --repo-url "https://github.com/username/repo.git" --use-proxy
165
+ ```
166
+
167
+ ## Managing Credentials
168
+
169
+ You can manage your credentials using the following commands:
170
+
171
+ ```bash
172
+ # Set up all credentials
173
+ ./gitarsenal.py credentials setup
174
+
175
+ # Set a specific credential
176
+ ./gitarsenal.py credentials set modal_token
177
+
178
+ # View a credential (masked for security)
179
+ ./gitarsenal.py credentials get modal_token
180
+
181
+ # Clear a specific credential
182
+ ./gitarsenal.py credentials clear huggingface_token
183
+
184
+ # Clear all credentials
185
+ ./gitarsenal.py credentials clear
186
+
187
+ # List all saved credentials (without showing values)
188
+ ./gitarsenal.py credentials list
189
+ ```
69
190
 
70
191
  ## Security
71
192
 
72
193
  Your credentials are stored securely in `~/.gitarsenal/credentials.json` with restrictive file permissions. The file is only readable by your user account.
73
194
 
195
+ Proxy configuration is stored in `~/.gitarsenal/proxy_config.json` with similar security measures.
196
+
74
197
  ## Troubleshooting
75
198
 
76
- If you encounter authentication issues:
199
+ ### Modal Authentication Issues
77
200
 
78
- 1. Check that your credentials are set up correctly:
201
+ If you see errors like "Token missing" or "Could not authenticate client":
202
+
203
+ 1. Ensure Modal is installed:
79
204
  ```bash
80
- python manage_credentials.py list
205
+ pip install modal
81
206
  ```
82
207
 
83
- 2. If needed, clear and reset your credentials:
208
+ 2. Get a new Modal token:
84
209
  ```bash
85
- python manage_credentials.py clear
86
- python manage_credentials.py setup
210
+ modal token new
87
211
  ```
88
212
 
89
- 3. Ensure Modal CLI is installed and authenticated:
213
+ 3. Save the token in GitArsenal:
90
214
  ```bash
91
- pip install modal
92
- modal token new
215
+ ./gitarsenal.py credentials set modal_token
216
+ ```
217
+
218
+ ### Proxy Service Issues
219
+
220
+ If you're having issues with the proxy service:
221
+
222
+ 1. Check if the proxy service is running:
223
+ ```bash
224
+ ./gitarsenal.py proxy status
225
+ ```
226
+
227
+ 2. Reconfigure the proxy service:
228
+ ```bash
229
+ ./gitarsenal.py proxy configure
230
+ ```
231
+
232
+ 3. Make sure you have a valid API key for the proxy service.
233
+
234
+ 4. Check the proxy service logs:
235
+ ```bash
236
+ cat modal_proxy.log
237
+ ```
238
+
239
+ 5. If using ngrok, make sure the tunnel is active and use the correct URL.
240
+
241
+ ### API Timeout Issues
242
+
243
+ If the GitArsenal API times out when analyzing repositories, the tool will automatically use fallback setup commands based on the detected programming language and technologies.
244
+
245
+ ### Other Issues
246
+
247
+ 1. Check that your credentials are set up correctly:
248
+ ```bash
249
+ ./gitarsenal.py credentials list
250
+ ```
251
+
252
+ 2. If needed, clear and reset your credentials:
253
+ ```bash
254
+ ./gitarsenal.py credentials clear
255
+ ./gitarsenal.py credentials setup
93
256
  ```
94
257
 
95
258
  ## License