gitarsenal-cli 1.9.33 → 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 +1 -1
- package/bin/gitarsenal.js +54 -6
- package/package.json +1 -1
package/.venv_status.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"created":"2025-08-
|
|
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
|
|
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,16 +139,58 @@ async function previewRecommendations(repoUrl) {
|
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
141
|
|
|
136
|
-
const
|
|
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
|
+
};
|
|
163
|
+
|
|
164
|
+
let data = null;
|
|
165
|
+
let lastErrorText = '';
|
|
166
|
+
|
|
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
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
137
184
|
spinner.stop();
|
|
138
185
|
|
|
139
|
-
if (!
|
|
140
|
-
console.log(chalk.yellow('⚠️
|
|
186
|
+
if (!data) {
|
|
187
|
+
console.log(chalk.yellow('⚠️ Preview unavailable (timeout or server error).'));
|
|
188
|
+
if (lastErrorText) console.log(chalk.gray(`Reason: ${lastErrorText}`));
|
|
141
189
|
return null;
|
|
142
190
|
}
|
|
143
191
|
|
|
144
|
-
printGpuTorchCudaSummary(
|
|
145
|
-
return
|
|
192
|
+
printGpuTorchCudaSummary(data);
|
|
193
|
+
return data;
|
|
146
194
|
} catch (e) {
|
|
147
195
|
spinner.stop();
|
|
148
196
|
console.log(chalk.yellow(`⚠️ Preview failed: ${e.message}`));
|