codebuff 1.0.335 → 1.0.337
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/index.js +21 -16
- package/package.json +4 -1
package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ const CONFIG = {
|
|
|
14
14
|
binaryName: process.platform === 'win32' ? 'codebuff.exe' : 'codebuff',
|
|
15
15
|
githubRepo: 'CodebuffAI/codebuff-community',
|
|
16
16
|
userAgent: 'codebuff-cli',
|
|
17
|
-
requestTimeout:
|
|
17
|
+
requestTimeout: 20000,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
CONFIG.binaryPath = path.join(CONFIG.configDir, CONFIG.binaryName)
|
|
@@ -79,28 +79,33 @@ function httpGet(url, options = {}) {
|
|
|
79
79
|
const timeout = options.timeout || CONFIG.requestTimeout
|
|
80
80
|
req.setTimeout(timeout, () => {
|
|
81
81
|
req.destroy()
|
|
82
|
-
reject(new Error('Request timeout'))
|
|
82
|
+
reject(new Error('Request timeout.'))
|
|
83
83
|
})
|
|
84
84
|
})
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
async function getLatestVersion() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/* ── simple rate-limit fallback ─────────────────────────── */
|
|
93
|
-
if (res.statusCode === 403 && res.headers['x-ratelimit-remaining'] === '0') {
|
|
94
|
-
term.writeLine(
|
|
95
|
-
'GitHub API rate-limit reached. Skipping version check – either wait an hour or set GITHUB_TOKEN and try again.'
|
|
88
|
+
try {
|
|
89
|
+
const res = await httpGet(
|
|
90
|
+
`https://github.com/${CONFIG.githubRepo}/releases.atom`
|
|
96
91
|
)
|
|
97
|
-
return null
|
|
98
|
-
}
|
|
99
92
|
|
|
100
|
-
|
|
93
|
+
if (res.statusCode !== 200) return null
|
|
94
|
+
|
|
95
|
+
const body = await streamToString(res)
|
|
96
|
+
|
|
97
|
+
// Parse the Atom XML to extract the latest release tag
|
|
98
|
+
const tagMatch = body.match(
|
|
99
|
+
/<id>tag:github\.com,2008:Repository\/\d+\/([^<]+)<\/id>/
|
|
100
|
+
)
|
|
101
|
+
if (tagMatch && tagMatch[1]) {
|
|
102
|
+
return tagMatch[1].replace(/^v/, '')
|
|
103
|
+
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
return null
|
|
106
|
+
} catch (error) {
|
|
107
|
+
return null
|
|
108
|
+
}
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
function streamToString(stream) {
|
|
@@ -248,7 +253,7 @@ async function ensureBinaryExists() {
|
|
|
248
253
|
} catch (error) {
|
|
249
254
|
term.clearLine()
|
|
250
255
|
console.error('❌ Failed to download codebuff:', error.message)
|
|
251
|
-
console.error('Please try again
|
|
256
|
+
console.error('Please check your internet connection and try again')
|
|
252
257
|
process.exit(1)
|
|
253
258
|
}
|
|
254
259
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebuff",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.337",
|
|
4
4
|
"description": "AI coding agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
7
|
"codebuff": "index.js"
|
|
8
8
|
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"preuninstall": "node -e \"const fs = require('fs'); const path = require('path'); const os = require('os'); const binaryPath = path.join(os.homedir(), '.config', 'manicode', process.platform === 'win32' ? 'codebuff.exe' : 'codebuff'); try { fs.unlinkSync(binaryPath) } catch (e) { /* ignore if file doesn't exist */ }\""
|
|
11
|
+
},
|
|
9
12
|
"files": [
|
|
10
13
|
"index.js",
|
|
11
14
|
"README.md"
|