codecane 1.0.398 → 1.0.400

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/package.json CHANGED
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "name": "codecane",
3
- "version": "1.0.398",
4
- "description": "AI dev assistant",
3
+ "version": "1.0.400",
4
+ "description": "AI coding agent",
5
5
  "license": "MIT",
6
6
  "bin": {
7
7
  "codecane": "scripts/codebuff-wrapper.js"
8
8
  },
9
- "scripts": {
10
- "postinstall": "node scripts/install.js"
11
- },
12
9
  "files": [
13
10
  "scripts/codebuff-wrapper.js",
14
- "scripts/install.js",
11
+ "scripts/download-binary.js",
15
12
  "README.md"
16
13
  ],
17
14
  "os": [
@@ -33,5 +30,8 @@
33
30
  "type": "git",
34
31
  "url": "https://github.com/CodebuffAI/codebuff-community.git"
35
32
  },
36
- "homepage": "https://codebuff.com"
33
+ "homepage": "https://codebuff.com",
34
+ "publishConfig": {
35
+ "access": "public"
36
+ }
37
37
  }
@@ -3,7 +3,7 @@
3
3
  const fs = require('fs')
4
4
  const path = require('path')
5
5
  const os = require('os')
6
- const { spawn } = require('child_process')
6
+ const { spawn, execSync } = require('child_process')
7
7
 
8
8
  const homeDir = os.homedir()
9
9
  const manicodeDir = path.join(homeDir, '.config', 'manicode')
@@ -12,9 +12,17 @@ const binaryPath = path.join(manicodeDir, binaryName)
12
12
 
13
13
  // Check if binary exists
14
14
  if (!fs.existsSync(binaryPath)) {
15
- console.error(`❌ Codebuff binary not found at ${binaryPath}`)
16
- console.error('Please reinstall codebuff: npm install -g codebuff')
17
- process.exit(1)
15
+ console.log('🔄 Codebuff binary not found. Downloading...')
16
+
17
+ try {
18
+ // Run the download script synchronously
19
+ const downloadScript = path.join(__dirname, 'download-binary.js')
20
+ execSync(`node "${downloadScript}"`, { stdio: 'inherit' })
21
+ } catch (error) {
22
+ console.error('❌ Failed to download codebuff binary')
23
+ console.error('Please try running: npm install -g codebuff')
24
+ process.exit(1)
25
+ }
18
26
  }
19
27
 
20
28
  // Check if binary is executable (Unix only)
@@ -23,7 +31,7 @@ if (process.platform !== 'win32') {
23
31
  fs.accessSync(binaryPath, fs.constants.X_OK)
24
32
  } catch (error) {
25
33
  console.error(`❌ Codebuff binary is not executable: ${binaryPath}`)
26
- console.error('Please reinstall codebuff: npm install -g codebuff')
34
+ console.error('Please try running: npm install -g codebuff')
27
35
  process.exit(1)
28
36
  }
29
37
  }
@@ -1,18 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Force output to show even when npm suppresses stdout
4
- const originalLog = console.log
5
- console.log = (...args) => {
6
- process.stderr.write(args.join(' ') + '\n')
7
- }
8
-
9
3
  const https = require('https')
10
4
  const fs = require('fs')
11
5
  const path = require('path')
12
6
  const os = require('os')
13
7
  const { platform, arch } = process
14
- const packageJson = require('../package.json')
15
- const ver = packageJson.version
8
+
9
+ // Get version from package.release.json
10
+ const packageJsonPath = path.join(__dirname, '..', 'package.release.json')
11
+ let version
12
+ try {
13
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
14
+ version = packageJson.version
15
+ } catch (error) {
16
+ console.error('❌ Could not read package.release.json version')
17
+ process.exit(1)
18
+ }
16
19
 
17
20
  const targets = {
18
21
  'linux-x64': 'codebuff-linux-x64.tar.gz',
@@ -31,9 +34,17 @@ if (!file) {
31
34
  process.exit(1)
32
35
  }
33
36
 
34
- const url = `https://github.com/CodebuffAI/codebuff-community/releases/download/v${ver}/${file}`
37
+ const url = `https://github.com/CodebuffAI/codebuff-community/releases/download/v${version}/${file}`
35
38
  const homeDir = os.homedir()
36
39
  const manicodeDir = path.join(homeDir, '.config', 'manicode')
40
+ const binaryName = platform === 'win32' ? 'codebuff.exe' : 'codebuff'
41
+ const binaryPath = path.join(manicodeDir, binaryName)
42
+
43
+ // Check if binary already exists
44
+ if (fs.existsSync(binaryPath)) {
45
+ console.log('✅ Binary already exists')
46
+ process.exit(0)
47
+ }
37
48
 
38
49
  // Create .config/manicode directory
39
50
  fs.mkdirSync(manicodeDir, { recursive: true })