refactor(core): rename ApplyPatchTool to PatchTool

This commit is contained in:
Dax Raad
2026-07-07 21:16:00 -04:00
parent e1abf59c59
commit 3379e44abb
3 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ import { SessionInstructions } from "../session/instructions"
import { SessionTodo } from "../session/todo" import { SessionTodo } from "../session/todo"
import { Shell } from "../shell" import { Shell } from "../shell"
import { SkillV2 } from "../skill" import { SkillV2 } from "../skill"
import { ApplyPatchTool } from "../tool/apply-patch" import { PatchTool } from "../tool/patch"
import { EditTool } from "../tool/edit" import { EditTool } from "../tool/edit"
import { GlobTool } from "../tool/glob" import { GlobTool } from "../tool/glob"
import { GrepTool } from "../tool/grep" import { GrepTool } from "../tool/grep"
@@ -127,7 +127,7 @@ const pre = [
SkillPlugin.Plugin, SkillPlugin.Plugin,
ModelsDevPlugin, ModelsDevPlugin,
...ProviderPlugins, ...ProviderPlugins,
ApplyPatchTool.Plugin, PatchTool.Plugin,
EditTool.Plugin, EditTool.Plugin,
GlobTool.Plugin, GlobTool.Plugin,
GrepTool.Plugin, GrepTool.Plugin,
@@ -1,4 +1,4 @@
export * as ApplyPatchTool from "./apply-patch" export * as PatchTool from "./patch"
import type { Context as PluginContext } from "@opencode-ai/plugin/v2/effect/plugin" import type { Context as PluginContext } from "@opencode-ai/plugin/v2/effect/plugin"
import { ToolFailure } from "@opencode-ai/llm" import { ToolFailure } from "@opencode-ai/llm"
@@ -55,8 +55,8 @@ type Prepared =
}) })
export const Plugin = { export const Plugin = {
id: "opencode.tool.apply-patch", id: "opencode.tool.patch",
effect: Effect.fn("ApplyPatchTool.Plugin")(function* (ctx: PluginContext) { effect: Effect.fn("PatchTool.Plugin")(function* (ctx: PluginContext) {
const mutation = yield* LocationMutation.Service const mutation = yield* LocationMutation.Service
const files = yield* FileMutation.Service const files = yield* FileMutation.Service
const fs = yield* FSUtil.Service const fs = yield* FSUtil.Service
@@ -13,16 +13,16 @@ import { AbsolutePath } from "@opencode-ai/core/schema"
import { SessionV2 } from "@opencode-ai/core/session" import { SessionV2 } from "@opencode-ai/core/session"
import { ToolRegistry } from "@opencode-ai/core/tool/registry" import { ToolRegistry } from "@opencode-ai/core/tool/registry"
import { ToolOutputStore } from "@opencode-ai/core/tool-output-store" import { ToolOutputStore } from "@opencode-ai/core/tool-output-store"
import { ApplyPatchTool } from "@opencode-ai/core/tool/apply-patch" import { PatchTool } from "@opencode-ai/core/tool/patch"
import { location } from "./fixture/location" import { location } from "./fixture/location"
import { tmpdir } from "./fixture/tmpdir" import { tmpdir } from "./fixture/tmpdir"
import { makeLocationNode } from "@opencode-ai/core/effect/app-node" import { makeLocationNode } from "@opencode-ai/core/effect/app-node"
import { testEffect } from "./lib/effect" import { testEffect } from "./lib/effect"
import { toolIdentity, executeTool, registerToolPlugin, settleTool, toolDefinitions } from "./lib/tool" import { toolIdentity, executeTool, registerToolPlugin, settleTool, toolDefinitions } from "./lib/tool"
const applyPatchToolNode = makeLocationNode({ const patchToolNode = makeLocationNode({
name: "test/apply-patch-tool-plugin", name: "test/patch-tool-plugin",
layer: Layer.effectDiscard(registerToolPlugin(ApplyPatchTool.Plugin)), layer: Layer.effectDiscard(registerToolPlugin(PatchTool.Plugin)),
deps: [ToolRegistry.toolsNode, LocationMutation.node, FileMutation.node, FSUtil.node, PermissionV2.node], deps: [ToolRegistry.toolsNode, LocationMutation.node, FileMutation.node, FSUtil.node, PermissionV2.node],
}) })
@@ -116,7 +116,7 @@ const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Inte
ToolRegistry.toolsNode, ToolRegistry.toolsNode,
LocationMutation.node, LocationMutation.node,
FileMutation.node, FileMutation.node,
applyPatchToolNode, patchToolNode,
]), ]),
[ [
[FSUtil.node, filesystem], [FSUtil.node, filesystem],
@@ -129,7 +129,7 @@ const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Inte
) )
} }
const call = (patchText: string, id = "call-apply-patch") => ({ const call = (patchText: string, id = "call-patch") => ({
sessionID, sessionID,
...toolIdentity, ...toolIdentity,
call: { type: "tool-call" as const, id, name: "patch", input: { patchText } }, call: { type: "tool-call" as const, id, name: "patch", input: { patchText } },
@@ -147,7 +147,7 @@ const exists = (target: string) =>
) )
const it = testEffect(Layer.empty) const it = testEffect(Layer.empty)
describe("ApplyPatchTool", () => { describe("PatchTool", () => {
it.live("registers and sequentially applies add, update, and delete hunks", () => it.live("registers and sequentially applies add, update, and delete hunks", () =>
Effect.acquireUseRelease( Effect.acquireUseRelease(
Effect.promise(() => tmpdir()), Effect.promise(() => tmpdir()),