diff --git a/.opencode/tools/tea-pr-create.ts b/.opencode/tools/tea-pr-create.ts new file mode 100644 index 0000000..5f3dc3c --- /dev/null +++ b/.opencode/tools/tea-pr-create.ts @@ -0,0 +1,24 @@ +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() + }, +}) diff --git a/.opencode/tools/tea-pr-get.ts b/.opencode/tools/tea-pr-get.ts new file mode 100644 index 0000000..4cd47a5 --- /dev/null +++ b/.opencode/tools/tea-pr-get.ts @@ -0,0 +1,13 @@ +import { tool } from "@opencode-ai/plugin" +import { $ } from "bun" + +export default tool({ + description: "Get a specific pull request with all details and comments using tea CLI", + args: { + pullNumber: tool.schema.number().describe("Pull request number/index"), + }, + async execute(args) { + const result = await $`tea pulls ${args.pullNumber} --comments --output json`.text() + return result.trim() + }, +}) diff --git a/.opencode/tools/tea-pulls.ts b/.opencode/tools/tea-pulls.ts new file mode 100644 index 0000000..0f43194 --- /dev/null +++ b/.opencode/tools/tea-pulls.ts @@ -0,0 +1,14 @@ +import { tool } from "@opencode-ai/plugin" +import { $ } from "bun" + +export default tool({ + description: "List pull requests in the repository using tea CLI", + args: { + state: tool.schema.string().optional().describe("Filter by state (all|open|closed)"), + }, + async execute(args) { + const state = args.state || "open" + const result = await $`tea pulls --state ${state} --output json`.text() + return result.trim() + }, +})