feat: add tea CLI pull request tools #110
@@ -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()
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -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()
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -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()
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user