codecane 1.0.408 → 1.0.409

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 +13 -31
  2. package/package.json +2 -3
package/index.js CHANGED
@@ -27,7 +27,7 @@ const PLATFORM_TARGETS = {
27
27
  'linux-arm64': 'codebuff-linux-arm64.tar.gz',
28
28
  'darwin-x64': 'codebuff-darwin-x64.tar.gz',
29
29
  'darwin-arm64': 'codebuff-darwin-arm64.tar.gz',
30
- 'win32-x64': 'codebuff-win32-x64.zip',
30
+ 'win32-x64': 'codebuff-win32-x64.tar.gz',
31
31
  }
32
32
 
33
33
  // Terminal utilities
@@ -206,45 +206,27 @@ async function downloadBinary(version) {
206
206
  const buffer = Buffer.concat(chunks)
207
207
 
208
208
  try {
209
- if (fileName.endsWith('.zip')) {
210
- // Windows ZIP extraction
211
- const AdmZip = require('adm-zip')
212
- const zipPath = path.join(CONFIG.configDir, fileName)
209
+ // Unix tar.gz extraction for all platforms
210
+ await new Promise((resolve, reject) => {
211
+ const gunzip = zlib.createGunzip()
212
+ const extract = tar.extract({ cwd: CONFIG.configDir })
213
213
 
214
- fs.writeFileSync(zipPath, buffer)
214
+ gunzip.pipe(extract).on('finish', resolve).on('error', reject)
215
215
 
216
- const zip = new AdmZip(zipPath)
217
- zip.extractAllTo(CONFIG.configDir, true)
218
-
219
- fs.unlinkSync(zipPath)
220
- } else {
221
- // Unix tar.gz extraction
222
- await new Promise((resolve, reject) => {
223
- const gunzip = zlib.createGunzip()
224
- const extract = tar.extract({ cwd: CONFIG.configDir })
225
-
226
- gunzip.pipe(extract).on('finish', resolve).on('error', reject)
227
-
228
- gunzip.end(buffer)
229
- })
230
- }
216
+ gunzip.end(buffer)
217
+ })
231
218
 
232
- // Rename extracted binary to standard name
233
- const extractedName = fileName.replace(/\.(tar\.gz|zip)$/, '')
234
- const extractedPath = path.join(CONFIG.configDir, extractedName)
219
+ // Find the extracted binary - it should be named "codebuff" or "codebuff.exe"
220
+ const files = fs.readdirSync(CONFIG.configDir)
221
+ const extractedPath = path.join(CONFIG.configDir, CONFIG.binaryName)
235
222
 
236
223
  if (fs.existsSync(extractedPath)) {
237
224
  if (process.platform !== 'win32') {
238
225
  fs.chmodSync(extractedPath, 0o755)
239
226
  }
240
- // Remove existing binary if it exists
241
- if (fs.existsSync(CONFIG.binaryPath)) {
242
- fs.unlinkSync(CONFIG.binaryPath)
243
- }
244
- fs.renameSync(extractedPath, CONFIG.binaryPath)
245
227
  } else {
246
228
  throw new Error(
247
- `Binary not found after extraction. Expected: ${extractedPath}.`
229
+ `Binary not found after extraction. Expected: ${extractedPath}, Available files: ${files.join(', ')}`
248
230
  )
249
231
  }
250
232
 
@@ -317,7 +299,7 @@ async function checkForUpdates(runningProcess, exitListener) {
317
299
  }, 5000)
318
300
  })
319
301
 
320
- console.log(`\nUpdate available: ${currentVersion} → ${latestVersion}`)
302
+ console.log(`Update available: ${currentVersion} → ${latestVersion}`)
321
303
 
322
304
  await downloadBinary(latestVersion)
323
305
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codecane",
3
- "version": "1.0.408",
3
+ "version": "1.0.409",
4
4
  "description": "AI coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -23,8 +23,7 @@
23
23
  "node": ">=16"
24
24
  },
25
25
  "dependencies": {
26
- "tar": "^6.2.0",
27
- "adm-zip": "^0.5.10"
26
+ "tar": "^6.2.0"
28
27
  },
29
28
  "repository": {
30
29
  "type": "git",