import { tool } from "@opencode-ai/plugin" import { $ } from "bun" export default tool({ description: "List workflow runs for Gitea actions with optional filters", args: { status: tool.schema.string().optional().describe("Filter by status (success, failure, pending, queued, in_progress, skipped, canceled)"), branch: tool.schema.string().optional().describe("Filter by branch name"), event: tool.schema.string().optional().describe("Filter by event type (push, pull_request, etc.)"), limit: tool.schema.number().optional().describe("Number of results to return (default: 30)"), since: tool.schema.string().optional().describe("Show runs started after this time (e.g., '24h', '7d')"), }, async execute(args) { let cmd = [`tea`, `actions`, `runs`, `list`, `-o`, `json`] if (args.status) cmd = [...cmd, `--status`, args.status] if (args.branch) cmd = [...cmd, `--branch`, args.branch] if (args.event) cmd = [...cmd, `--event`, args.event] if (args.limit) cmd = [...cmd, `--limit`, String(args.limit)] if (args.since) cmd = [...cmd, `--since`, args.since] const result = await $`${cmd}`.text() return result.trim() }, })