From 1a900037ff0259012a0aa21a27301903631a5f02 Mon Sep 17 00:00:00 2001 From: Hugo Nijhuis Date: Sun, 3 May 2026 16:35:24 +0200 Subject: [PATCH] feat: add tea-milestone.ts tool for milestone management (milestoneList, milestoneCreate) --- .opencode/tools/tea-milestone.ts | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .opencode/tools/tea-milestone.ts diff --git a/.opencode/tools/tea-milestone.ts b/.opencode/tools/tea-milestone.ts new file mode 100644 index 0000000..1d5a748 --- /dev/null +++ b/.opencode/tools/tea-milestone.ts @@ -0,0 +1,52 @@ +import { tool } from "@opencode-ai/plugin" +import { $ } from "bun" + +export const milestoneList = tool({ + description: "List milestones with their status and progress", + args: { + state: tool.schema.enum(["open", "closed", "all"]).default("open").describe("Filter by state"), + }, + async execute(args, context) { + try { + const result = await $`tea milestone list --output json --state ${args.state}`.text() + return JSON.parse(result) + } catch (error: any) { + return { + error: "Failed to list milestones", + message: error.message, + stderr: error.stderr?.toString(), + } + } + }, +}) + +export const milestoneCreate = tool({ + description: "Create a new milestone with title, description, and optional due date", + args: { + title: tool.schema.string().describe("Milestone title"), + description: tool.schema.string().optional().describe("Milestone description"), + dueDate: tool.schema.string().optional().describe("Due date (format: YYYY-MM-DD)"), + }, + async execute(args, context) { + try { + let cmd = $`tea milestone create --output json --title ${args.title}` + + if (args.description) { + cmd = cmd`--description ${args.description}` + } + + if (args.dueDate) { + cmd = cmd`--due-date ${args.dueDate}` + } + + const result = await cmd.text() + return JSON.parse(result) + } catch (error: any) { + return { + error: "Failed to create milestone", + message: error.message, + stderr: error.stderr?.toString(), + } + } + }, +}) \ No newline at end of file