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.
Files changed (2) hide show
  1. package/index.js +37 -32
  2. 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
- const downloadUrl = `https://github.com/${CONFIG.githubRepo}/releases/download/v${version}/${fileName}`
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 (!fs.existsSync(CONFIG.binaryPath)) {
299
- const version = await getLatestVersion()
300
- if (!version) {
301
- if (isPrintMode) {
302
- console.error(
303
- JSON.stringify({
304
- type: 'error',
305
- message: 'Failed to determine latest version.',
306
- }),
307
- )
308
- } else {
309
- console.error('❌ Failed to determine latest version')
310
- console.error('Please check your internet connection and try again')
311
- }
312
- process.exit(1)
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
- try {
316
- await downloadBinary(version)
317
- } catch (error) {
318
- term.clearLine()
319
- if (isPrintMode) {
320
- console.error(
321
- JSON.stringify({
322
- type: 'error',
323
- message: `Failed to download codebuff: ${error.message}`,
324
- }),
325
- )
326
- } else {
327
- console.error('❌ Failed to download codebuff:', error.message)
328
- console.error('Please check your internet connection and try again')
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebuff",
3
- "version": "1.0.503",
3
+ "version": "1.0.505",
4
4
  "description": "AI coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {