import { $ } from "bun" import type { Info } from "@opencode/plugin/promise/tool" const teaActionsRunsLogs: Info = { name: "tea-actions-runs-logs", description: "Get logs for a specific Gitea actions workflow run to diagnose failures", input: { type: "object", properties: { runId: { type: "number", description: "Workflow run ID to get logs for" }, job: { type: "string", description: "Specific job ID to view (if omitted, shows all jobs)" }, }, required: ["runId"], additionalProperties: false, }, async execute(input) { const { runId, job } = input as { runId: number; job?: string } let cmd = [`tea`, `actions`, `runs`, `logs`] if (job) cmd = [...cmd, `--job`, job] cmd = [...cmd, String(runId), `-o`, `simple`] const result = await $`${cmd}`.text() return { content: result.trim() } }, } export default teaActionsRunsLogs