onlycode 1.19.0 → 1.20.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.OPENCODE_BIN_PATH
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 = "opencode-" + platform + "-" + arch
74
- const binary = platform === "windows" ? "opencode.exe" : "opencode"
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
- "It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing " +
227
- names.map((n) => `\"${n}\"`).join(" or ") +
228
- " package",
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,15 +1,15 @@
1
1
  {
2
2
  "name": "onlycode",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "AI-powered development tool - OnlyCode CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "private": false,
8
8
  "bin": {
9
- "onlycode": "./bin/opencode.cjs"
9
+ "onlycode": "./bin/onlycode.cjs"
10
10
  },
11
11
  "files": [
12
- "bin",
12
+ "bin/onlycode.cjs",
13
13
  "README.md"
14
14
  ],
15
15
  "keywords": ["ai", "cli", "coding", "assistant", "onlycode"],