migrated custom tools to V2 plugin
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { $ } from "bun"
|
||||
import type { Info } from "@opencode/plugin/promise/tool"
|
||||
|
||||
const gitWorktreeCreate: Info = {
|
||||
name: "git-worktree-create",
|
||||
description: "Create a git worktree for a branch or PR",
|
||||
input: {
|
||||
type: "object",
|
||||
properties: {
|
||||
branch: { type: "string", description: "Branch name or PR number" },
|
||||
},
|
||||
required: ["branch"],
|
||||
additionalProperties: false,
|
||||
},
|
||||
async execute(input) {
|
||||
const { branch } = input as { branch: string }
|
||||
const result = await $`git worktree add ../worktrees/${branch}`.text()
|
||||
return { content: result.trim() }
|
||||
},
|
||||
}
|
||||
|
||||
export default gitWorktreeCreate
|
||||
Reference in New Issue
Block a user