codebuff 1.0.503 → 1.0.506
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/index.js +38 -32
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -215,7 +215,10 @@ async function downloadBinary(version) {
|
|
|
215
215
|
throw new Error(`Unsupported platform: ${process.platform} ${process.arch}`)
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
// Use proxy endpoint that handles version mapping
|
|
219
|
+
const downloadUrl = process.env.NEXT_PUBLIC_CODEBUFF_APP_URL
|
|
220
|
+
? `${process.env.NEXT_PUBLIC_CODEBUFF_APP_URL}/api/releases/download/${version}/${fileName}`
|
|
221
|
+
: `https://codebuff.com/api/releases/download/${version}/${fileName}`
|
|
219
222
|
|
|
220
223
|
// Ensure config directory exists
|
|
221
224
|
fs.mkdirSync(CONFIG.configDir, { recursive: true })
|
|
@@ -295,40 +298,43 @@ async function downloadBinary(version) {
|
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
async function ensureBinaryExists() {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
301
|
+
const currentVersion = await getCurrentVersion()
|
|
302
|
+
if (currentVersion !== null && currentVersion !== 'error') {
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const version = await getLatestVersion()
|
|
307
|
+
if (!version) {
|
|
308
|
+
if (isPrintMode) {
|
|
309
|
+
console.error(
|
|
310
|
+
JSON.stringify({
|
|
311
|
+
type: 'error',
|
|
312
|
+
message: 'Failed to determine latest version.',
|
|
313
|
+
}),
|
|
314
|
+
)
|
|
315
|
+
} else {
|
|
316
|
+
console.error('❌ Failed to determine latest version')
|
|
317
|
+
console.error('Please check your internet connection and try again')
|
|
313
318
|
}
|
|
319
|
+
process.exit(1)
|
|
320
|
+
}
|
|
314
321
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
process.exit(1)
|
|
322
|
+
try {
|
|
323
|
+
await downloadBinary(version)
|
|
324
|
+
} catch (error) {
|
|
325
|
+
term.clearLine()
|
|
326
|
+
if (isPrintMode) {
|
|
327
|
+
console.error(
|
|
328
|
+
JSON.stringify({
|
|
329
|
+
type: 'error',
|
|
330
|
+
message: `Failed to download codebuff: ${error.message}`,
|
|
331
|
+
}),
|
|
332
|
+
)
|
|
333
|
+
} else {
|
|
334
|
+
console.error('❌ Failed to download codebuff:', error.message)
|
|
335
|
+
console.error('Please check your internet connection and try again')
|
|
331
336
|
}
|
|
337
|
+
process.exit(1)
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
340
|
|