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 +1 -1
- package/bin/gitarsenal.js +49 -19
- 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,29 +139,53 @@ async function previewRecommendations(repoUrl) {
|
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
164
|
+
let data = null;
|
|
165
|
+
let lastErrorText = '';
|
|
148
166
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
184
|
+
spinner.stop();
|
|
185
|
+
|
|
157
186
|
if (!data) {
|
|
158
|
-
console.log(chalk.yellow('⚠️
|
|
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
|
|