gitarsenal-cli 1.9.34 → 1.9.35

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-08-10T17:58:47.793Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
1
+ {"created":"2025-08-10T18:05:08.203Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
package/bin/gitarsenal.js CHANGED
@@ -108,7 +108,13 @@ function activateVirtualEnvironment() {
108
108
  async function previewRecommendations(repoUrl) {
109
109
  const spinner = ora('Analyzing repository for GPU/Torch/CUDA recommendations...').start();
110
110
  try {
111
- const apiUrl = process.env.GITARSENAL_API_URL || 'https://www.gitarsenal.dev/api/gitingest-setup-commands';
111
+ const envUrl = process.env.GITARSENAL_API_URL;
112
+ const endpoints = envUrl
113
+ ? [envUrl]
114
+ : [
115
+ 'https://www.gitarsenal.dev/api/gitingest-setup-commands'
116
+ ];
117
+
112
118
  const payload = {
113
119
  repoUrl,
114
120
  // Minimal GitIngest data to allow backend to run LLM analysis
@@ -133,29 +139,53 @@ async function previewRecommendations(repoUrl) {
133
139
  }
134
140
  };
135
141
 
136
- // Use global fetch (Node 18+) and follow redirects
137
- const res = await fetch(apiUrl, {
138
- method: 'POST',
139
- headers: {
140
- 'Content-Type': 'application/json',
141
- 'User-Agent': 'GitArsenal-CLI/1.0'
142
- },
143
- body: JSON.stringify(payload),
144
- redirect: 'follow'
145
- });
142
+ const fetchWithTimeout = async (url, body, timeoutMs = 20000) => {
143
+ const controller = new AbortController();
144
+ const id = setTimeout(() => controller.abort(), timeoutMs);
145
+ try {
146
+ const res = await fetch(url, {
147
+ method: 'POST',
148
+ headers: {
149
+ 'Content-Type': 'application/json',
150
+ 'User-Agent': 'GitArsenal-CLI/1.0'
151
+ },
152
+ body: JSON.stringify(body),
153
+ redirect: 'follow',
154
+ signal: controller.signal
155
+ });
156
+ clearTimeout(id);
157
+ return res;
158
+ } catch (e) {
159
+ clearTimeout(id);
160
+ throw e;
161
+ }
162
+ };
146
163
 
147
- spinner.stop();
164
+ let data = null;
165
+ let lastErrorText = '';
148
166
 
149
- if (!res.ok) {
150
- const text = await res.text().catch(() => '');
151
- console.log(chalk.yellow(`⚠️ Preview request failed (${res.status}).`));
152
- if (text) console.log(chalk.gray(`Response: ${text.slice(0, 500)}`));
153
- return null;
167
+ for (const url of endpoints) {
168
+ try {
169
+ spinner.text = `Analyzing (preview): ${url}`;
170
+ const res = await fetchWithTimeout(url, payload, 20000);
171
+ if (!res.ok) {
172
+ const text = await res.text().catch(() => '');
173
+ lastErrorText = `${res.status} ${text.slice(0, 300)}`;
174
+ continue;
175
+ }
176
+ data = await res.json().catch(() => null);
177
+ if (data) break;
178
+ } catch (err) {
179
+ lastErrorText = err && err.message ? err.message : 'request failed';
180
+ continue;
181
+ }
154
182
  }
155
183
 
156
- const data = await res.json().catch(() => null);
184
+ spinner.stop();
185
+
157
186
  if (!data) {
158
- console.log(chalk.yellow('⚠️ Could not parse recommendations preview response.'));
187
+ console.log(chalk.yellow('⚠️ Preview unavailable (timeout or server error).'));
188
+ if (lastErrorText) console.log(chalk.gray(`Reason: ${lastErrorText}`));
159
189
  return null;
160
190
  }
161
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.9.34",
3
+ "version": "1.9.35",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {