mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
fix(opencode): address migration review feedback
This commit is contained in:
@@ -497,18 +497,14 @@ export const GithubRunCommand = cmd({
|
||||
const gitText = async (args: string[]) => {
|
||||
const result = await git(args, { cwd: Instance.worktree })
|
||||
if (result.exitCode !== 0) {
|
||||
throw new Error(
|
||||
result.stderr.toString().trim() || result.stdout.toString().trim() || `git ${args.join(" ")} failed`,
|
||||
)
|
||||
throw new Process.RunFailedError(["git", ...args], result.exitCode, result.stdout, result.stderr)
|
||||
}
|
||||
return result.text().trim()
|
||||
}
|
||||
const gitRun = async (args: string[]) => {
|
||||
const result = await git(args, { cwd: Instance.worktree })
|
||||
if (result.exitCode !== 0) {
|
||||
throw new Error(
|
||||
result.stderr.toString().trim() || result.stdout.toString().trim() || `git ${args.join(" ")} failed`,
|
||||
)
|
||||
throw new Process.RunFailedError(["git", ...args], result.exitCode, result.stdout, result.stderr)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export namespace Installation {
|
||||
}
|
||||
|
||||
export async function upgrade(method: Method, target: string) {
|
||||
let result
|
||||
let result: Awaited<ReturnType<typeof upgradeCurl>> | undefined
|
||||
switch (method) {
|
||||
case "curl":
|
||||
result = await upgradeCurl(target)
|
||||
@@ -183,15 +183,24 @@ export namespace Installation {
|
||||
...process.env,
|
||||
}
|
||||
if (formula.includes("/")) {
|
||||
await Process.run(["brew", "tap", "anomalyco/tap"], { env, nothrow: true })
|
||||
const tap = await Process.run(["brew", "tap", "anomalyco/tap"], { env, nothrow: true })
|
||||
if (tap.code !== 0) {
|
||||
result = tap
|
||||
break
|
||||
}
|
||||
const repo = (await Process.text(["brew", "--repo", "anomalyco/tap"], { env, nothrow: true })).text.trim()
|
||||
if (repo) await Process.run(["git", "pull", "--ff-only"], { cwd: repo, env, nothrow: true })
|
||||
result = await Process.run(["brew", "upgrade", formula], { env, nothrow: true })
|
||||
break
|
||||
if (repo) {
|
||||
const pull = await Process.run(["git", "pull", "--ff-only"], { cwd: repo, env, nothrow: true })
|
||||
if (pull.code !== 0) {
|
||||
result = pull
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
result = await Process.run(["brew", "upgrade", formula], { env, nothrow: true })
|
||||
break
|
||||
}
|
||||
|
||||
case "choco":
|
||||
result = await Process.run(["choco", "upgrade", "opencode", `--version=${target}`, "-y"], { nothrow: true })
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user