codebuff-cli 1.0.16 → 1.0.17
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/LICENSE +202 -0
- package/README.md +202 -58
- package/README.zh-CN.md +251 -0
- package/cli/README.md +84 -0
- package/cli/bin/codebuff.cjs +165 -0
- package/cli/scripts/download-binary.cjs +164 -0
- package/package.json +78 -31
- package/http.js +0 -176
- package/index.js +0 -592
- package/postinstall.js +0 -34
package/package.json
CHANGED
|
@@ -1,43 +1,90 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebuff-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "1.0.17",
|
|
4
|
+
"license": "Apache-2.0",
|
|
6
5
|
"bin": {
|
|
7
|
-
"codebuff": "
|
|
8
|
-
"codebuff-cli": "
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"postinstall": "node postinstall.js",
|
|
12
|
-
"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 */ }\""
|
|
6
|
+
"codebuff": "cli/bin/codebuff.cjs",
|
|
7
|
+
"codebuff-cli": "cli/bin/codebuff.cjs"
|
|
13
8
|
},
|
|
14
9
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
10
|
+
"cli/bin/codebuff.cjs",
|
|
11
|
+
"cli/scripts/download-binary.cjs",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
19
14
|
],
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"workspaces": [
|
|
20
|
+
".agents",
|
|
21
|
+
"common",
|
|
22
|
+
"packages/*",
|
|
23
|
+
"scripts",
|
|
24
|
+
"evals",
|
|
25
|
+
"sdk",
|
|
26
|
+
"agents",
|
|
27
|
+
"cli"
|
|
28
28
|
],
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "bun start-cli",
|
|
31
|
+
"up": "bun scripts/start-services.ts",
|
|
32
|
+
"start-cli": "bun --cwd cli dev",
|
|
33
|
+
"start-db": "bun --cwd packages/internal db:start",
|
|
34
|
+
"start-studio": "bun --cwd packages/internal db:studio",
|
|
35
|
+
"down": "bun scripts/stop-services.ts",
|
|
36
|
+
"ps": "bun scripts/status-services.ts",
|
|
37
|
+
"format": "prettier --write \"**/*.{ts,tsx,json,md}\"",
|
|
38
|
+
"release:cli": "bun run --cwd=cli release",
|
|
39
|
+
"release:sdk": "bun run --cwd=sdk release",
|
|
40
|
+
"clean-ts": "find . -name '*.tsbuildinfo' -type f -delete && find . -name '.next' -type d -exec rm -rf {} + 2>/dev/null || true && find . -name 'node_modules' -type d -exec rm -rf {} + 2>/dev/null || true && bun install",
|
|
41
|
+
"typecheck": "bun scripts/check-env-architecture.ts && bun --filter='*' run typecheck && echo '✅ All type checks passed!'",
|
|
42
|
+
"test": "bun --filter='{@codebuff/common,@codebuff/agents,@codebuff/agent-runtime,@codebuff/sdk,@codebuff/cli,@codebuff/evals,@codebuff/scripts}' run test",
|
|
43
|
+
"init-worktree": "bun scripts/init-worktree.ts",
|
|
44
|
+
"cleanup-worktree": "bun scripts/cleanup-worktree.ts",
|
|
45
|
+
"generate-tool-definitions": "bun scripts/generate-tool-definitions.ts"
|
|
31
46
|
},
|
|
32
47
|
"dependencies": {
|
|
33
|
-
"
|
|
48
|
+
"@t3-oss/env-nextjs": "^0.7.3",
|
|
49
|
+
"canvas": "^3.2.0",
|
|
50
|
+
"gif-encoder-2": "^1.0.5",
|
|
51
|
+
"zod": "^4.2.1"
|
|
34
52
|
},
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
53
|
+
"overrides": {
|
|
54
|
+
"react": "^19.0.0",
|
|
55
|
+
"react-dom": "^19.0.0",
|
|
56
|
+
"@types/react": "19.2.14",
|
|
57
|
+
"@types/react-dom": "19.2.3",
|
|
58
|
+
"baseline-browser-mapping": "^2.9.14",
|
|
59
|
+
"caniuse-lite": "^1.0.30001792",
|
|
60
|
+
"zod": "^4.2.1",
|
|
61
|
+
"signal-exit": "3.0.7"
|
|
38
62
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@tanstack/react-query": "^5.90.12",
|
|
65
|
+
"@types/bun": "1.3.11",
|
|
66
|
+
"@types/js-yaml": "^4.0.9",
|
|
67
|
+
"@types/lodash": "^4.17.21",
|
|
68
|
+
"@types/node": "^22.9.0",
|
|
69
|
+
"@types/node-fetch": "^2.6.12",
|
|
70
|
+
"@types/parse-path": "^7.1.0",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^6.17",
|
|
72
|
+
"bun-types": "1.3.11",
|
|
73
|
+
"eslint-config-prettier": "^9.1.0",
|
|
74
|
+
"eslint-plugin-import": "^2.29.1",
|
|
75
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
76
|
+
"ignore": "^6.0.2",
|
|
77
|
+
"lodash": "4.17.23",
|
|
78
|
+
"prettier": "^3.7.4",
|
|
79
|
+
"ts-node": "^10.9.2",
|
|
80
|
+
"ts-pattern": "^5.9.0",
|
|
81
|
+
"tsc-alias": "^1.8.16",
|
|
82
|
+
"tsconfig-paths": "4.2.0",
|
|
83
|
+
"typescript": "5.5.4",
|
|
84
|
+
"typescript-eslint": "^7.17.0"
|
|
85
|
+
},
|
|
86
|
+
"engines": {
|
|
87
|
+
"bun": "1.3.11"
|
|
88
|
+
},
|
|
89
|
+
"packageManager": "bun@1.3.11"
|
|
43
90
|
}
|
package/http.js
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
const http = require('http')
|
|
2
|
-
const https = require('https')
|
|
3
|
-
const tls = require('tls')
|
|
4
|
-
|
|
5
|
-
function createReleaseHttpClient({
|
|
6
|
-
env = process.env,
|
|
7
|
-
userAgent,
|
|
8
|
-
requestTimeout,
|
|
9
|
-
httpModule = http,
|
|
10
|
-
httpsModule = https,
|
|
11
|
-
tlsModule = tls,
|
|
12
|
-
}) {
|
|
13
|
-
function getProxyUrl() {
|
|
14
|
-
return (
|
|
15
|
-
env.HTTPS_PROXY ||
|
|
16
|
-
env.https_proxy ||
|
|
17
|
-
env.HTTP_PROXY ||
|
|
18
|
-
env.http_proxy ||
|
|
19
|
-
null
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function shouldBypassProxy(hostname) {
|
|
24
|
-
const noProxy = env.NO_PROXY || env.no_proxy || ''
|
|
25
|
-
if (!noProxy) return false
|
|
26
|
-
|
|
27
|
-
const domains = noProxy
|
|
28
|
-
.split(',')
|
|
29
|
-
.map((domain) => domain.trim().toLowerCase().replace(/:\d+$/, ''))
|
|
30
|
-
const host = hostname.toLowerCase()
|
|
31
|
-
|
|
32
|
-
return domains.some((domain) => {
|
|
33
|
-
if (domain === '*') return true
|
|
34
|
-
if (domain.startsWith('.')) {
|
|
35
|
-
return host.endsWith(domain) || host === domain.slice(1)
|
|
36
|
-
}
|
|
37
|
-
return host === domain || host.endsWith(`.${domain}`)
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function connectThroughProxy(proxyUrl, targetHost, targetPort) {
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
const proxy = new URL(proxyUrl)
|
|
44
|
-
const isHttpsProxy = proxy.protocol === 'https:'
|
|
45
|
-
const connectOptions = {
|
|
46
|
-
hostname: proxy.hostname,
|
|
47
|
-
port: proxy.port || (isHttpsProxy ? 443 : 80),
|
|
48
|
-
method: 'CONNECT',
|
|
49
|
-
path: `${targetHost}:${targetPort}`,
|
|
50
|
-
headers: {
|
|
51
|
-
Host: `${targetHost}:${targetPort}`,
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (proxy.username || proxy.password) {
|
|
56
|
-
const auth = Buffer.from(
|
|
57
|
-
`${decodeURIComponent(proxy.username || '')}:${decodeURIComponent(
|
|
58
|
-
proxy.password || '',
|
|
59
|
-
)}`,
|
|
60
|
-
).toString('base64')
|
|
61
|
-
connectOptions.headers['Proxy-Authorization'] = `Basic ${auth}`
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const transport = isHttpsProxy ? httpsModule : httpModule
|
|
65
|
-
const req = transport.request(connectOptions)
|
|
66
|
-
|
|
67
|
-
req.on('connect', (res, socket) => {
|
|
68
|
-
if (res.statusCode === 200) {
|
|
69
|
-
resolve(socket)
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
socket.destroy()
|
|
74
|
-
reject(new Error(`Proxy CONNECT failed with status ${res.statusCode}`))
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
req.on('error', (error) => {
|
|
78
|
-
reject(new Error(`Proxy connection failed: ${error.message}`))
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
req.setTimeout(requestTimeout, () => {
|
|
82
|
-
req.destroy()
|
|
83
|
-
reject(new Error('Proxy connection timeout.'))
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
req.end()
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async function buildRequestOptions(url, options = {}) {
|
|
91
|
-
const parsedUrl = new URL(url)
|
|
92
|
-
const reqOptions = {
|
|
93
|
-
hostname: parsedUrl.hostname,
|
|
94
|
-
port: parsedUrl.port || 443,
|
|
95
|
-
path: parsedUrl.pathname + parsedUrl.search,
|
|
96
|
-
headers: {
|
|
97
|
-
'User-Agent': userAgent,
|
|
98
|
-
...options.headers,
|
|
99
|
-
},
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const proxyUrl = getProxyUrl()
|
|
103
|
-
if (!proxyUrl || shouldBypassProxy(parsedUrl.hostname)) {
|
|
104
|
-
return reqOptions
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const tunnelSocket = await connectThroughProxy(
|
|
108
|
-
proxyUrl,
|
|
109
|
-
parsedUrl.hostname,
|
|
110
|
-
parsedUrl.port || 443,
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
class TunnelAgent extends httpsModule.Agent {
|
|
114
|
-
createConnection(_options, callback) {
|
|
115
|
-
const secureSocket = tlsModule.connect({
|
|
116
|
-
socket: tunnelSocket,
|
|
117
|
-
servername: parsedUrl.hostname,
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
if (typeof callback === 'function') {
|
|
121
|
-
if (typeof secureSocket.once === 'function') {
|
|
122
|
-
let settled = false
|
|
123
|
-
const finish = (error) => {
|
|
124
|
-
if (settled) return
|
|
125
|
-
settled = true
|
|
126
|
-
callback(error || null, error ? undefined : secureSocket)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
secureSocket.once('secureConnect', () => finish(null))
|
|
130
|
-
secureSocket.once('error', (error) => finish(error))
|
|
131
|
-
} else {
|
|
132
|
-
callback(null, secureSocket)
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return secureSocket
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
reqOptions.agent = new TunnelAgent({ keepAlive: false })
|
|
141
|
-
return reqOptions
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
async function httpGet(url, options = {}) {
|
|
145
|
-
const reqOptions = await buildRequestOptions(url, options)
|
|
146
|
-
|
|
147
|
-
return new Promise((resolve, reject) => {
|
|
148
|
-
const req = httpsModule.get(reqOptions, (res) => {
|
|
149
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
150
|
-
res.resume()
|
|
151
|
-
httpGet(new URL(res.headers.location, url).href, options)
|
|
152
|
-
.then(resolve)
|
|
153
|
-
.catch(reject)
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
resolve(res)
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
req.on('error', reject)
|
|
161
|
-
req.setTimeout(options.timeout || requestTimeout, () => {
|
|
162
|
-
req.destroy()
|
|
163
|
-
reject(new Error('Request timeout.'))
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
getProxyUrl,
|
|
170
|
-
httpGet,
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
module.exports = {
|
|
175
|
-
createReleaseHttpClient,
|
|
176
|
-
}
|