summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKit Langton <[email protected]>2026-04-10 23:52:48 -0400
committerGitHub <[email protected]>2026-04-10 23:52:48 -0400
commitfe4dfb9f6f3051c78599636bcc1dcc036c9ed518 (patch)
treeb393a2f9594ac8d8eecab985df10f685b0fea575
parent5e3dc8099921952925b6a70853cb06f5e4bebcdc (diff)
downloadopencode-fe4dfb9f6f3051c78599636bcc1dcc036c9ed518.tar.gz
opencode-fe4dfb9f6f3051c78599636bcc1dcc036c9ed518.zip
refactor(git): remove runtime facade wrappers (#21982)
-rw-r--r--packages/opencode/src/cli/cmd/github.ts12
-rw-r--r--packages/opencode/src/cli/cmd/pr.ts25
-rw-r--r--packages/opencode/src/git/index.ts11
3 files changed, 26 insertions, 22 deletions
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts
index 8b693e79a..28a05512d 100644
--- a/packages/opencode/src/cli/cmd/github.ts
+++ b/packages/opencode/src/cli/cmd/github.ts
@@ -29,6 +29,7 @@ import { Provider } from "../../provider/provider"
import { Bus } from "../../bus"
import { MessageV2 } from "../../session/message-v2"
import { SessionPrompt } from "@/session/prompt"
+import { AppRuntime } from "@/effect/app-runtime"
import { Git } from "@/git"
import { setTimeout as sleep } from "node:timers/promises"
import { Process } from "@/util/process"
@@ -258,7 +259,9 @@ export const GithubInstallCommand = cmd({
}
// Get repo info
- const info = (await Git.run(["remote", "get-url", "origin"], { cwd: Instance.worktree })).text().trim()
+ const info = await AppRuntime.runPromise(
+ Git.Service.use((git) => git.run(["remote", "get-url", "origin"], { cwd: Instance.worktree })),
+ ).then((x) => x.text().trim())
const parsed = parseGitHubRemote(info)
if (!parsed) {
prompts.log.error(`Could not find git repository. Please run this command from a git repository.`)
@@ -497,20 +500,21 @@ export const GithubRunCommand = cmd({
: "issue"
: undefined
const gitText = async (args: string[]) => {
- const result = await Git.run(args, { cwd: Instance.worktree })
+ const result = await AppRuntime.runPromise(Git.Service.use((git) => git.run(args, { cwd: Instance.worktree })))
if (result.exitCode !== 0) {
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.run(args, { cwd: Instance.worktree })
+ const result = await AppRuntime.runPromise(Git.Service.use((git) => git.run(args, { cwd: Instance.worktree })))
if (result.exitCode !== 0) {
throw new Process.RunFailedError(["git", ...args], result.exitCode, result.stdout, result.stderr)
}
return result
}
- const gitStatus = (args: string[]) => Git.run(args, { cwd: Instance.worktree })
+ const gitStatus = (args: string[]) =>
+ AppRuntime.runPromise(Git.Service.use((git) => git.run(args, { cwd: Instance.worktree })))
const commitChanges = async (summary: string, actor?: string) => {
const args = ["commit", "-m", summary]
if (actor) args.push("-m", `Co-authored-by: ${actor} <${actor}@users.noreply.github.com>`)
diff --git a/packages/opencode/src/cli/cmd/pr.ts b/packages/opencode/src/cli/cmd/pr.ts
index 58d42c6ef..f392bab4c 100644
--- a/packages/opencode/src/cli/cmd/pr.ts
+++ b/packages/opencode/src/cli/cmd/pr.ts
@@ -1,5 +1,6 @@
import { UI } from "../ui"
import { cmd } from "./cmd"
+import { AppRuntime } from "@/effect/app-runtime"
import { Git } from "@/git"
import { Instance } from "@/project/instance"
import { Process } from "@/util/process"
@@ -67,19 +68,29 @@ export const PrCommand = cmd({
const remoteName = forkOwner
// Check if remote already exists
- const remotes = (await Git.run(["remote"], { cwd: Instance.worktree })).text().trim()
+ const remotes = await AppRuntime.runPromise(
+ Git.Service.use((git) => git.run(["remote"], { cwd: Instance.worktree })),
+ ).then((x) => x.text().trim())
if (!remotes.split("\n").includes(remoteName)) {
- await Git.run(["remote", "add", remoteName, `https://github.com/${forkOwner}/${forkName}.git`], {
- cwd: Instance.worktree,
- })
+ await AppRuntime.runPromise(
+ Git.Service.use((git) =>
+ git.run(["remote", "add", remoteName, `https://github.com/${forkOwner}/${forkName}.git`], {
+ cwd: Instance.worktree,
+ }),
+ ),
+ )
UI.println(`Added fork remote: ${remoteName}`)
}
// Set upstream to the fork so pushes go there
const headRefName = prInfo.headRefName
- await Git.run(["branch", `--set-upstream-to=${remoteName}/${headRefName}`, localBranchName], {
- cwd: Instance.worktree,
- })
+ await AppRuntime.runPromise(
+ Git.Service.use((git) =>
+ git.run(["branch", `--set-upstream-to=${remoteName}/${headRefName}`, localBranchName], {
+ cwd: Instance.worktree,
+ }),
+ ),
+ )
}
// Check for opencode session link in PR body
diff --git a/packages/opencode/src/git/index.ts b/packages/opencode/src/git/index.ts
index de84fdd74..ac964ee0a 100644
--- a/packages/opencode/src/git/index.ts
+++ b/packages/opencode/src/git/index.ts
@@ -1,7 +1,6 @@
import * as CrossSpawnSpawner from "@/effect/cross-spawn-spawner"
import { Effect, Layer, Context, Stream } from "effect"
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
-import { makeRuntime } from "@/effect/run-service"
export namespace Git {
const cfg = [
@@ -258,14 +257,4 @@ export namespace Git {
)
export const defaultLayer = layer.pipe(Layer.provide(CrossSpawnSpawner.defaultLayer))
-
- const { runPromise } = makeRuntime(Service, defaultLayer)
-
- export async function run(args: string[], opts: Options) {
- return runPromise((git) => git.run(args, opts))
- }
-
- export async function defaultBranch(cwd: string) {
- return runPromise((git) => git.defaultBranch(cwd))
- }
}