Files
HugoNijhuis ec45a86c27 feat: add tea CLI pull request tools
Add three tools for managing pull requests via the tea CLI:
- tea-pulls: list pull requests filtered by state
- tea-pr-get: get PR details with comments
- tea-pr-create: create a PR with title, branch, assignees, and labels
2026-07-29 21:48:13 +02:00

25 lines
1.2 KiB
TypeScript

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()
},
})