onlycode 1.19.0 → 1.21.0
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.
|
@@ -43,13 +43,12 @@ function run(target) {
|
|
|
43
43
|
})
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const envPath = process.env.
|
|
46
|
+
const envPath = process.env.ONLYCODE_BIN_PATH
|
|
47
47
|
|
|
48
48
|
const scriptPath = fs.realpathSync(__filename)
|
|
49
49
|
const scriptDir = path.dirname(scriptPath)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
const cached = path.join(scriptDir, ".opencode")
|
|
51
|
+
const cached = path.join(scriptDir, ".onlycode")
|
|
53
52
|
|
|
54
53
|
const platformMap = {
|
|
55
54
|
darwin: "darwin",
|
|
@@ -70,8 +69,8 @@ let arch = archMap[os.arch()]
|
|
|
70
69
|
if (!arch) {
|
|
71
70
|
arch = os.arch()
|
|
72
71
|
}
|
|
73
|
-
const base = "
|
|
74
|
-
const binary = platform === "windows" ? "
|
|
72
|
+
const base = "onlycode-" + platform + "-" + arch
|
|
73
|
+
const binary = platform === "windows" ? "onlycode.exe" : "onlycode"
|
|
75
74
|
|
|
76
75
|
function supportsAvx2() {
|
|
77
76
|
if (arch !== "x64") return false
|
|
@@ -188,44 +187,11 @@ function findBinary(startDir) {
|
|
|
188
187
|
|
|
189
188
|
const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
|
|
190
189
|
if (!resolved) {
|
|
191
|
-
// 开发模式:尝试直接运行源码
|
|
192
|
-
const srcPath = path.join(scriptDir, "..", "src", "index.ts")
|
|
193
|
-
if (fs.existsSync(srcPath)) {
|
|
194
|
-
console.log("Running in development mode...")
|
|
195
|
-
|
|
196
|
-
// 尝试多种方式找到 bun
|
|
197
|
-
let bunCmd = "bun"
|
|
198
|
-
const possiblePaths = [
|
|
199
|
-
path.join(process.env.APPDATA || "", "npm", "bun.cmd"),
|
|
200
|
-
path.join(process.env.APPDATA || "", "npm", "bun"),
|
|
201
|
-
"C:\\Users\\Administrator\\AppData\\Roaming\\npm\\bun.cmd",
|
|
202
|
-
"C:\\Users\\Administrator\\AppData\\Roaming\\npm\\bun",
|
|
203
|
-
]
|
|
204
|
-
|
|
205
|
-
for (const p of possiblePaths) {
|
|
206
|
-
if (fs.existsSync(p)) {
|
|
207
|
-
bunCmd = p
|
|
208
|
-
break
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const bun = childProcess.spawn(bunCmd, ["run", "--conditions=browser", srcPath, ...process.argv.slice(2)], {
|
|
213
|
-
stdio: "inherit",
|
|
214
|
-
cwd: path.join(scriptDir, ".."),
|
|
215
|
-
shell: true,
|
|
216
|
-
})
|
|
217
|
-
bun.on("exit", (code) => process.exit(code || 0))
|
|
218
|
-
bun.on("error", (err) => {
|
|
219
|
-
console.error("Failed to run bun:", err.message)
|
|
220
|
-
process.exit(1)
|
|
221
|
-
})
|
|
222
|
-
return
|
|
223
|
-
}
|
|
224
|
-
|
|
225
190
|
console.error(
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
191
|
+
"OnlyCode CLI 未找到平台二进制文件。\n\n" +
|
|
192
|
+
"请安装对应平台的包:\n" +
|
|
193
|
+
names.map((n) => ` npm install -g ${n}`).join("\n") + "\n\n" +
|
|
194
|
+
"或设置 ONLYCODE_BIN_PATH 环境变量指向二进制文件路径。"
|
|
229
195
|
)
|
|
230
196
|
process.exit(1)
|
|
231
197
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onlycode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "AI-powered development tool - OnlyCode CLI",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"private": false,
|
|
8
7
|
"bin": {
|
|
9
|
-
"onlycode": "./bin/
|
|
8
|
+
"onlycode": "./bin/onlycode.cjs"
|
|
10
9
|
},
|
|
11
10
|
"files": [
|
|
12
|
-
"bin",
|
|
11
|
+
"bin/onlycode.cjs",
|
|
13
12
|
"README.md"
|
|
14
13
|
],
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"onlycode-windows-x64": "1.21.0",
|
|
16
|
+
"onlycode-windows-arm64": "1.21.0",
|
|
17
|
+
"onlycode-linux-x64": "1.21.0",
|
|
18
|
+
"onlycode-linux-arm64": "1.21.0",
|
|
19
|
+
"onlycode-darwin-x64": "1.21.0",
|
|
20
|
+
"onlycode-darwin-arm64": "1.21.0"
|
|
21
|
+
},
|
|
15
22
|
"keywords": ["ai", "cli", "coding", "assistant", "onlycode"],
|
|
16
23
|
"repository": {
|
|
17
24
|
"type": "git",
|