gitarsenal-cli 1.9.102 → 1.9.103

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/.venv_status.json CHANGED
@@ -1 +1 @@
1
- {"created":"2025-09-14T10:53:02.337Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
1
+ {"created":"2025-09-14T11:00:57.034Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
@@ -41,13 +41,41 @@ function getPythonExecutable() {
41
41
  return isWindows ? 'python' : 'python3';
42
42
  }
43
43
 
44
+ /**
45
+ * Fetch Anthropic API key directly from the server
46
+ * @returns {Promise<string>} - The Anthropic API key
47
+ */
48
+ async function fetchAnthropicApiKey() {
49
+ try {
50
+ const pythonExecutable = getPythonExecutable();
51
+ const fetchTokensScript = path.join(__dirname, '..', 'python', 'fetch_modal_tokens.py');
52
+
53
+ // Run the fetch_modal_tokens.py script with --output-anthropic-key flag
54
+ const { stdout, stderr } = await execAsync(`${pythonExecutable} ${fetchTokensScript} --output-anthropic-key`, {
55
+ env: { ...process.env },
56
+ timeout: 30000 // 30 seconds timeout
57
+ });
58
+
59
+ // Parse the output to find the Anthropic API key
60
+ const anthropicKeyMatch = stdout.match(/ANTHROPIC_API_KEY=([a-zA-Z0-9\-_]+)/);
61
+ if (anthropicKeyMatch && anthropicKeyMatch[1]) {
62
+ const anthropicApiKey = anthropicKeyMatch[1];
63
+ return anthropicApiKey;
64
+ }
65
+
66
+ return null;
67
+ } catch (error) {
68
+ console.error(chalk.red(`❌ Error fetching Anthropic API key: ${error.message}`));
69
+ return null;
70
+ }
71
+ }
72
+
44
73
  /**
45
74
  * Fetch E2B API key directly from the server
46
75
  * @returns {Promise<string>} - The E2B API key
47
76
  */
48
77
  async function fetchE2BApiKey() {
49
78
  try {
50
- console.log(chalk.blue('🔄 Fetching E2B API key directly from server...'));
51
79
 
52
80
  const pythonExecutable = getPythonExecutable();
53
81
  const fetchTokensScript = path.join(__dirname, '..', 'python', 'fetch_modal_tokens.py');
@@ -151,8 +179,19 @@ async function runE2BSandbox(options) {
151
179
 
152
180
  // Get OpenAI and Anthropic API keys from environment or apiKeys
153
181
  const openaiApiKey = apiKeys.OPENAI_API_KEY || process.env.OPENAI_API_KEY;
154
- const anthropicApiKey = apiKeys.ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY;
155
-
182
+ let anthropicApiKey = apiKeys.ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY;
183
+
184
+ // If Anthropic API key is not found, try to fetch it directly from the server
185
+ if (!anthropicApiKey) {
186
+ console.log(chalk.blue('🔄 Fetching Anthropic API key directly from server...'));
187
+ anthropicApiKey = await fetchAnthropicApiKey();
188
+ if (anthropicApiKey) {
189
+ console.log(chalk.green('✅ Successfully fetched Anthropic API key from server'));
190
+ // Add it to apiKeys so it gets passed to the Python script
191
+ apiKeys.ANTHROPIC_API_KEY = anthropicApiKey;
192
+ }
193
+ }
194
+
156
195
  // Run the e2b_sandbox_agent.py script with the repository URL
157
196
  const scriptPath = path.join(__dirname, '..', 'python', 'e2b_sandbox_agent.py');
158
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.9.102",
3
+ "version": "1.9.103",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -487,11 +487,19 @@ def run_e2b_sandbox(repo_url, setup_commands=None, api_keys=None):
487
487
  if e2b_api_key and e2b_api_key != "your_e2b_api_key" and not e2b_api_key.startswith("placeholder"):
488
488
  # Set it in the environment for the Sandbox.create() call
489
489
  os.environ["E2B_API_KEY"] = e2b_api_key
490
+ print(f"✅ Successfully fetched E2B API key from server (format: {e2b_api_key[:6]}...)")
490
491
  else:
491
492
  print("⚠️ Could not get valid E2B API key from server")
492
493
  e2b_api_key = None
494
+
495
+ # Also set the Anthropic API key if available
496
+ if anthropic_api_key and anthropic_api_key != "your_anthropic_api_key" and not anthropic_api_key.startswith("placeholder"):
497
+ if api_keys is None:
498
+ api_keys = {}
499
+ api_keys["ANTHROPIC_API_KEY"] = anthropic_api_key
500
+ print(f"✅ Successfully fetched Anthropic API key from server (format: {anthropic_api_key[:5]}...)")
493
501
  except Exception as e:
494
- print(f"⚠️ Could not fetch E2B API key from server: {e}")
502
+ print(f"⚠️ Could not fetch API keys from server: {e}")
495
503
  e2b_api_key = None
496
504
 
497
505
  # If we couldn't fetch the key directly, check if it's in api_keys
@@ -619,6 +627,18 @@ os.environ['{key_name}'] = '{key_value}'
619
627
  print(f"✅ Set {key_name} in sandbox environment")
620
628
  """)
621
629
 
630
+ # Double-check that the Anthropic API key is set in the sandbox environment
631
+ if api_keys and 'ANTHROPIC_API_KEY' in api_keys:
632
+ anthropic_key = api_keys['ANTHROPIC_API_KEY']
633
+ # Verify the key is set in the sandbox environment
634
+ sandbox.run_code("""
635
+ import os
636
+ if 'ANTHROPIC_API_KEY' in os.environ:
637
+ print(f"✅ Verified ANTHROPIC_API_KEY is set in sandbox environment (format: {os.environ['ANTHROPIC_API_KEY'][:5]}...)")
638
+ else:
639
+ print("❌ ANTHROPIC_API_KEY is not set in sandbox environment")
640
+ """)
641
+
622
642
  print("\n" + "="*80)
623
643
  print("🤖 CLAUDE AGENT REPOSITORY SETUP")
624
644
  print("="*80)
@@ -191,6 +191,7 @@ if __name__ == "__main__":
191
191
  parser.add_argument('--proxy-url', help='URL of the proxy server')
192
192
  parser.add_argument('--proxy-api-key', help='API key for the proxy server')
193
193
  parser.add_argument('--output-e2b-key', action='store_true', help='Output the E2B API key directly for JavaScript to use')
194
+ parser.add_argument('--output-anthropic-key', action='store_true', help='Output the Anthropic API key directly for JavaScript to use')
194
195
  args = parser.parse_args()
195
196
 
196
197
  # Set proxy URL and API key in environment variables if provided
@@ -210,6 +211,11 @@ if __name__ == "__main__":
210
211
  print(f"E2B_API_KEY={e2b_api_key}")
211
212
  sys.exit(0)
212
213
 
214
+ # If --output-anthropic-key is specified, output the Anthropic API key directly
215
+ if args.output_anthropic_key and anthropic_api_key:
216
+ print(f"ANTHROPIC_API_KEY={anthropic_api_key}")
217
+ sys.exit(0)
218
+
213
219
  print(f"Token ID: {token_id}")
214
220
  print(f"Token Secret: {token_secret}")
215
221
  print(f"E2B API Key: {e2b_api_key[:5] + '...' if e2b_api_key else None}")