codebuff 1.0.503 → 1.0.505
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 +37 -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,42 @@ async function downloadBinary(version) {
|
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
async function ensureBinaryExists() {
|
|
298
|
-
if (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
301
|
+
if ((await getCurrentVersion()) !== null) {
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const version = await getLatestVersion()
|
|
306
|
+
if (!version) {
|
|
307
|
+
if (isPrintMode) {
|
|
308
|
+
console.error(
|
|
309
|
+
JSON.stringify({
|
|
310
|
+
type: 'error',
|
|
311
|
+
message: 'Failed to determine latest version.',
|
|
312
|
+
}),
|
|
313
|
+
)
|
|
314
|
+
} else {
|
|
315
|
+
console.error('❌ Failed to determine latest version')
|
|
316
|
+
console.error('Please check your internet connection and try again')
|
|
313
317
|
}
|
|
318
|
+
process.exit(1)
|
|
319
|
+
}
|
|
314
320
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
process.exit(1)
|
|
321
|
+
try {
|
|
322
|
+
await downloadBinary(version)
|
|
323
|
+
} catch (error) {
|
|
324
|
+
term.clearLine()
|
|
325
|
+
if (isPrintMode) {
|
|
326
|
+
console.error(
|
|
327
|
+
JSON.stringify({
|
|
328
|
+
type: 'error',
|
|
329
|
+
message: `Failed to download codebuff: ${error.message}`,
|
|
330
|
+
}),
|
|
331
|
+
)
|
|
332
|
+
} else {
|
|
333
|
+
console.error('❌ Failed to download codebuff:', error.message)
|
|
334
|
+
console.error('Please check your internet connection and try again')
|
|
331
335
|
}
|
|
336
|
+
process.exit(1)
|
|
332
337
|
}
|
|
333
338
|
}
|
|
334
339
|
|