codecane 1.0.408 → 1.0.410

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 +15 -44
  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
@@ -200,56 +200,38 @@ async function downloadBinary(version) {
200
200
  }
201
201
  }
202
202
  }
203
+ console.log('Download complete!')
203
204
 
204
205
  term.write('Extracting...')
205
206
 
206
207
  const buffer = Buffer.concat(chunks)
207
208
 
208
209
  try {
209
- if (fileName.endsWith('.zip')) {
210
- // Windows ZIP extraction
211
- const AdmZip = require('adm-zip')
212
- const zipPath = path.join(CONFIG.configDir, fileName)
210
+ // Unix tar.gz extraction for all platforms
211
+ await new Promise((resolve, reject) => {
212
+ const gunzip = zlib.createGunzip()
213
+ const extract = tar.extract({ cwd: CONFIG.configDir })
213
214
 
214
- fs.writeFileSync(zipPath, buffer)
215
+ gunzip.pipe(extract).on('finish', resolve).on('error', reject)
215
216
 
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
- }
217
+ gunzip.end(buffer)
218
+ })
231
219
 
232
- // Rename extracted binary to standard name
233
- const extractedName = fileName.replace(/\.(tar\.gz|zip)$/, '')
234
- const extractedPath = path.join(CONFIG.configDir, extractedName)
220
+ // Find the extracted binary - it should be named "codebuff" or "codebuff.exe"
221
+ const files = fs.readdirSync(CONFIG.configDir)
222
+ const extractedPath = path.join(CONFIG.configDir, CONFIG.binaryName)
235
223
 
236
224
  if (fs.existsSync(extractedPath)) {
237
225
  if (process.platform !== 'win32') {
238
226
  fs.chmodSync(extractedPath, 0o755)
239
227
  }
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
228
  } else {
246
229
  throw new Error(
247
- `Binary not found after extraction. Expected: ${extractedPath}.`
230
+ `Binary not found after extraction. Expected: ${extractedPath}, Available files: ${files.join(', ')}`
248
231
  )
249
232
  }
250
233
 
251
- // Clear the line after successful download
252
- term.clearLine()
234
+ term.write('Starting Codebuff...')
253
235
  } catch (error) {
254
236
  term.clearLine()
255
237
  console.error(`Extraction failed: ${error.message}`)
@@ -275,17 +257,6 @@ async function ensureBinaryExists() {
275
257
  process.exit(1)
276
258
  }
277
259
  }
278
-
279
- // Verify binary is executable (Unix only)
280
- if (process.platform !== 'win32') {
281
- try {
282
- fs.accessSync(CONFIG.binaryPath, fs.constants.X_OK)
283
- } catch (error) {
284
- console.error(`❌ Binary is not executable: ${CONFIG.binaryPath}`)
285
- console.error('Run: chmod +x', CONFIG.binaryPath)
286
- process.exit(1)
287
- }
288
- }
289
260
  }
290
261
 
291
262
  async function checkForUpdates(runningProcess, exitListener) {
@@ -317,7 +288,7 @@ async function checkForUpdates(runningProcess, exitListener) {
317
288
  }, 5000)
318
289
  })
319
290
 
320
- console.log(`\nUpdate available: ${currentVersion} → ${latestVersion}`)
291
+ console.log(`Update available: ${currentVersion} → ${latestVersion}`)
321
292
 
322
293
  await downloadBinary(latestVersion)
323
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codecane",
3
- "version": "1.0.408",
3
+ "version": "1.0.410",
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",