mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-02 10:46:46 +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 gitText = async (args: string[]) => {
|
||||||
const result = await git(args, { cwd: Instance.worktree })
|
const result = await git(args, { cwd: Instance.worktree })
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
throw new Error(
|
throw new Process.RunFailedError(["git", ...args], result.exitCode, result.stdout, result.stderr)
|
||||||
result.stderr.toString().trim() || result.stdout.toString().trim() || `git ${args.join(" ")} failed`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return result.text().trim()
|
return result.text().trim()
|
||||||
}
|
}
|
||||||
const gitRun = async (args: string[]) => {
|
const gitRun = async (args: string[]) => {
|
||||||
const result = await git(args, { cwd: Instance.worktree })
|
const result = await git(args, { cwd: Instance.worktree })
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
throw new Error(
|
throw new Process.RunFailedError(["git", ...args], result.exitCode, result.stdout, result.stderr)
|
||||||
result.stderr.toString().trim() || result.stdout.toString().trim() || `git ${args.join(" ")} failed`,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export namespace Installation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function upgrade(method: Method, target: string) {
|
export async function upgrade(method: Method, target: string) {
|
||||||
let result
|
let result: Awaited<ReturnType<typeof upgradeCurl>> | undefined
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case "curl":
|
case "curl":
|
||||||
result = await upgradeCurl(target)
|
result = await upgradeCurl(target)
|
||||||
@@ -183,15 +183,24 @@ export namespace Installation {
|
|||||||
...process.env,
|
...process.env,
|
||||||
}
|
}
|
||||||
if (formula.includes("/")) {
|
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()
|
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 })
|
if (repo) {
|
||||||
result = await Process.run(["brew", "upgrade", formula], { env, nothrow: true })
|
const pull = await Process.run(["git", "pull", "--ff-only"], { cwd: repo, env, nothrow: true })
|
||||||
break
|
if (pull.code !== 0) {
|
||||||
|
result = pull
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result = await Process.run(["brew", "upgrade", formula], { env, nothrow: true })
|
result = await Process.run(["brew", "upgrade", formula], { env, nothrow: true })
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
case "choco":
|
case "choco":
|
||||||
result = await Process.run(["choco", "upgrade", "opencode", `--version=${target}`, "-y"], { nothrow: true })
|
result = await Process.run(["choco", "upgrade", "opencode", `--version=${target}`, "-y"], { nothrow: true })
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user