chore: generate
This commit is contained in:
@@ -37,7 +37,14 @@ export const PrCommand = effectCmd({
|
|||||||
|
|
||||||
const prInfoResult = yield* Effect.promise(() =>
|
const prInfoResult = yield* Effect.promise(() =>
|
||||||
Process.text(
|
Process.text(
|
||||||
["gh", "pr", "view", `${prNumber}`, "--json", "headRepository,headRepositoryOwner,isCrossRepository,headRefName,body"],
|
[
|
||||||
|
"gh",
|
||||||
|
"pr",
|
||||||
|
"view",
|
||||||
|
`${prNumber}`,
|
||||||
|
"--json",
|
||||||
|
"headRepository,headRepositoryOwner,isCrossRepository,headRefName,body",
|
||||||
|
],
|
||||||
{ nothrow: true },
|
{ nothrow: true },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -54,14 +61,15 @@ export const PrCommand = effectCmd({
|
|||||||
|
|
||||||
const remotes = (yield* git.run(["remote"], { cwd: worktree })).text().trim()
|
const remotes = (yield* git.run(["remote"], { cwd: worktree })).text().trim()
|
||||||
if (!remotes.split("\n").includes(remoteName)) {
|
if (!remotes.split("\n").includes(remoteName)) {
|
||||||
yield* git.run(["remote", "add", remoteName, `https://github.com/${forkOwner}/${forkName}.git`], { cwd: worktree })
|
yield* git.run(["remote", "add", remoteName, `https://github.com/${forkOwner}/${forkName}.git`], {
|
||||||
|
cwd: worktree,
|
||||||
|
})
|
||||||
UI.println(`Added fork remote: ${remoteName}`)
|
UI.println(`Added fork remote: ${remoteName}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
yield* git.run(
|
yield* git.run(["branch", `--set-upstream-to=${remoteName}/${prInfo.headRefName}`, localBranchName], {
|
||||||
["branch", `--set-upstream-to=${remoteName}/${prInfo.headRefName}`, localBranchName],
|
cwd: worktree,
|
||||||
{ cwd: worktree },
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prInfo?.body) {
|
if (prInfo?.body) {
|
||||||
@@ -71,7 +79,9 @@ export const PrCommand = effectCmd({
|
|||||||
UI.println(`Found opencode session: ${sessionUrl}`)
|
UI.println(`Found opencode session: ${sessionUrl}`)
|
||||||
UI.println(`Importing session...`)
|
UI.println(`Importing session...`)
|
||||||
|
|
||||||
const importResult = yield* Effect.promise(() => Process.text(["opencode", "import", sessionUrl], { nothrow: true }))
|
const importResult = yield* Effect.promise(() =>
|
||||||
|
Process.text(["opencode", "import", sessionUrl], { nothrow: true }),
|
||||||
|
)
|
||||||
if (importResult.code === 0) {
|
if (importResult.code === 0) {
|
||||||
const sessionIdMatch = importResult.text.trim().match(/Imported session: ([a-zA-Z0-9_-]+)/)
|
const sessionIdMatch = importResult.text.trim().match(/Imported session: ([a-zA-Z0-9_-]+)/)
|
||||||
if (sessionIdMatch) {
|
if (sessionIdMatch) {
|
||||||
@@ -89,13 +99,14 @@ export const PrCommand = effectCmd({
|
|||||||
UI.println()
|
UI.println()
|
||||||
|
|
||||||
const opencodeArgs = sessionId ? ["-s", sessionId] : []
|
const opencodeArgs = sessionId ? ["-s", sessionId] : []
|
||||||
const code = yield* Effect.promise(() =>
|
const code = yield* Effect.promise(
|
||||||
Process.spawn(["opencode", ...opencodeArgs], {
|
() =>
|
||||||
stdin: "inherit",
|
Process.spawn(["opencode", ...opencodeArgs], {
|
||||||
stdout: "inherit",
|
stdin: "inherit",
|
||||||
stderr: "inherit",
|
stdout: "inherit",
|
||||||
cwd: process.cwd(),
|
stderr: "inherit",
|
||||||
}).exited,
|
cwd: process.cwd(),
|
||||||
|
}).exited,
|
||||||
)
|
)
|
||||||
// Match legacy throw semantics — propagate as a defect so the top-level
|
// Match legacy throw semantics — propagate as a defect so the top-level
|
||||||
// index.ts catch handles it identically (exit 1, "Unexpected error" banner).
|
// index.ts catch handles it identically (exit 1, "Unexpected error" banner).
|
||||||
|
|||||||
Reference in New Issue
Block a user