codebuff 1.0.446 → 1.0.448

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 +26 -13
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs')
4
- const path = require('path')
5
- const os = require('os')
6
3
  const { spawn } = require('child_process')
4
+ const fs = require('fs')
7
5
  const https = require('https')
6
+ const os = require('os')
7
+ const path = require('path')
8
8
  const zlib = require('zlib')
9
- const tar = require('tar')
9
+
10
10
  const { Command } = require('commander')
11
+ const tar = require('tar')
11
12
 
12
13
  const CONFIG = {
13
14
  homeDir: os.homedir(),
@@ -92,7 +93,7 @@ function httpGet(url, options = {}) {
92
93
  async function getLatestVersion() {
93
94
  try {
94
95
  const res = await httpGet(
95
- `https://github.com/${CONFIG.githubRepo}/releases.atom`
96
+ `https://github.com/${CONFIG.githubRepo}/releases.atom`,
96
97
  )
97
98
 
98
99
  if (res.statusCode !== 200) return null
@@ -101,7 +102,7 @@ async function getLatestVersion() {
101
102
 
102
103
  // Parse the Atom XML to extract the latest release tag
103
104
  const tagMatch = body.match(
104
- /<id>tag:github\.com,2008:Repository\/\d+\/([^<]+)<\/id>/
105
+ /<id>tag:github\.com,2008:Repository\/\d+\/([^<]+)<\/id>/,
105
106
  )
106
107
  if (tagMatch && tagMatch[1]) {
107
108
  return tagMatch[1].replace(/^v/, '')
@@ -244,8 +245,8 @@ async function downloadBinary(version) {
244
245
  const pct = Math.round((downloadedSize / totalSize) * 100)
245
246
  term.write(
246
247
  `Downloading... ${createProgressBar(pct)} ${pct}% of ${formatBytes(
247
- totalSize
248
- )}`
248
+ totalSize,
249
+ )}`,
249
250
  )
250
251
  } else {
251
252
  term.write(`Downloading... ${formatBytes(downloadedSize)}`)
@@ -272,7 +273,7 @@ async function downloadBinary(version) {
272
273
  }
273
274
  } else {
274
275
  throw new Error(
275
- `Binary not found after extraction. Expected: ${extractedPath}, Available files: ${files.join(', ')}`
276
+ `Binary not found after extraction. Expected: ${extractedPath}, Available files: ${files.join(', ')}`,
276
277
  )
277
278
  }
278
279
  } catch (error) {
@@ -285,8 +286,10 @@ async function downloadBinary(version) {
285
286
 
286
287
  term.clearLine()
287
288
  if (isPrintMode) {
288
- console.log(JSON.stringify({type: 'download', version, status: 'complete'})) }
289
- else {
289
+ console.log(
290
+ JSON.stringify({ type: 'download', version, status: 'complete' }),
291
+ )
292
+ } else {
290
293
  console.log('Download complete! Starting Codebuff...')
291
294
  }
292
295
  }
@@ -296,7 +299,12 @@ async function ensureBinaryExists() {
296
299
  const version = await getLatestVersion()
297
300
  if (!version) {
298
301
  if (isPrintMode) {
299
- console.error(JSON.stringify({type: 'error', message: 'Failed to determinie latest version.'}))
302
+ console.error(
303
+ JSON.stringify({
304
+ type: 'error',
305
+ message: 'Failed to determinie latest version.',
306
+ }),
307
+ )
300
308
  } else {
301
309
  console.error('❌ Failed to determine latest version')
302
310
  console.error('Please check your internet connection and try again')
@@ -309,7 +317,12 @@ async function ensureBinaryExists() {
309
317
  } catch (error) {
310
318
  term.clearLine()
311
319
  if (isPrintMode) {
312
- console.error(JSON.stringify({type: 'error', message: `Failed to download codebuff: ${error.message}`}))
320
+ console.error(
321
+ JSON.stringify({
322
+ type: 'error',
323
+ message: `Failed to download codebuff: ${error.message}`,
324
+ }),
325
+ )
313
326
  } else {
314
327
  console.error('❌ Failed to download codebuff:', error.message)
315
328
  console.error('Please check your internet connection and try again')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebuff",
3
- "version": "1.0.446",
3
+ "version": "1.0.448",
4
4
  "description": "AI coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {