opencode-config/.opencode/tools/pipeline-status.ts
Sergey a8f9aa0bc6
feat: migrate .opencode/ config from opencode (#23)
* feat: migrate .opencode/ config from opencode

* refactor: rename repo refs and sanitize for public

* docs(handoff): add pr-7 handoff + ADR-002

* docs(handoff): fix PR number

* docs: update project map with .opencode/ structure

---------

Co-authored-by: opencode-agent <agent@slaid098.dev>
2026-07-23 22:57:39 +03:00

21 lines
No EOL
872 B
TypeScript

import { spawnSync } from "child_process"
import path from "path"
import { tool } from "@opencode-ai/plugin"
export default tool({
description: "Pipeline status oracle. Returns current phase + NEXT action for a PR. Call BEFORE any pipeline action. Read-only. Blocks up to 5 min while CI runs (polling Actions API). Returns DONE on green, NOT_DONE on failure, AMBIGUOUS on timeout/API error.",
args: {
pr_number: tool.schema.number().describe("PR number to check"),
},
async execute(args, context) {
const script = path.join(import.meta.dir, "..", "scripts", "pipeline-status.py")
const r = spawnSync("python3", [script, String(args.pr_number)], {
encoding: "utf-8",
cwd: context.worktree,
})
if (r.status !== 0) {
return `⚠️ pipeline_status failed (exit ${r.status}): ${r.stderr}`
}
return r.stdout.trim()
},
})