Skip to content

Commit 1588907

Browse files
committed
fix(upgrade): 修复 upgrade 命令两个问题
1. npm/pnpm/bun 升级路径改为报错并提示使用 curl 方式, 避免误装 kilocode 包(czcode 未发布到 npm registry) 2. 为 upgrade 命令添加 update alias,修复 ./czcode update 被 yargs 误解析为 run 命令的 message 参数导致 chdir 报错
1 parent 1f24123 commit 1588907

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

packages/opencode/src/cli/cmd/upgrade.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { InstallationVersion } from "@opencode-ai/core/installation/version"
66

77
export const UpgradeCommand = {
88
command: "upgrade [target]",
9+
aliases: ["update"], // czcode_change - alias 'update' to 'upgrade'
910
describe: "upgrade czcode to the latest or a specific version", // czcode_change
1011
builder: (yargs: Argv) => {
1112
return yargs

packages/opencode/src/installation/index.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,14 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | ChildPro
284284
case "curl":
285285
upgradeResult = yield* upgradeCurl(target)
286286
break
287+
// czcode_change start - npm/pnpm/bun not supported, redirect to curl
287288
case "npm":
288-
upgradeResult = yield* run(["npm", "install", "-g", `@kilocode/cli@${target}`]) // kilocode_change
289-
break
290289
case "pnpm":
291-
upgradeResult = yield* run(["pnpm", "install", "-g", `@kilocode/cli@${target}`]) // kilocode_change
292-
break
293290
case "bun":
294-
upgradeResult = yield* run(["bun", "install", "-g", `@kilocode/cli@${target}`]) // kilocode_change
295-
break
291+
return yield* new UpgradeFailedError({
292+
stderr: `czcode 不支持通过 ${m} 升级。\n请使用 curl 方式重新安装最新版本:\nhttps://github.com/clickzetta/czcode/releases`,
293+
})
294+
// czcode_change end
296295
case "brew": {
297296
const formula = yield* getBrewFormula()
298297
const env = { HOMEBREW_NO_AUTO_UPDATE: "1" }

0 commit comments

Comments
 (0)