import { tool } from "@opencode-ai/plugin" import { $ } from "bun" export default tool({ description: "Create a pull request in the repository using tea CLI", args: { title: tool.schema.string().describe("PR title"), head: tool.schema.string().optional().describe("Branch name of the PR source (defaults to current branch)"), base: tool.schema.string().optional().describe("Branch name of the PR target (defaults to repository default branch)"), description: tool.schema.string().optional().describe("PR description (supports markdown)"), assignees: tool.schema.string().optional().describe("Comma-separated list of usernames to assign"), labels: tool.schema.string().optional().describe("Comma-separated list of labels to assign"), }, async execute(args) { let cmd = [`tea`, `pulls`, `create`, `-t`, args.title] if (args.head) cmd = [...cmd, `--head`, args.head] if (args.base) cmd = [...cmd, `-b`, args.base] if (args.description) cmd = [...cmd, `-d`, args.description] if (args.assignees) cmd = [...cmd, `-a`, args.assignees] if (args.labels) cmd = [...cmd, `-L`, args.labels] const result = await $`${cmd}`.text() return result.trim() }, })