opencode-config/.opencode/tools/spec-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

22 lines
No EOL
886 B
TypeScript

import { spawnSync } from "child_process"
import path from "path"
import { tool } from "@opencode-ai/plugin"
export default tool({
description: "Spec status oracle. Returns current phase + NEXT action for spec-driver. Call BEFORE any spec action. Read-only. Returns DONE on phase complete, NOT_DONE on missing section, AMBIGUOUS on parse error.",
args: {
validate: tool.schema.boolean().optional().describe("If true, show all phases detail"),
},
async execute(args, context) {
const script = path.join(import.meta.dir, "..", "scripts", "spec-status.py")
const cmdArgs = args.validate ? ["--validate"] : []
const r = spawnSync("python3", [script, ...cmdArgs], {
encoding: "utf-8",
cwd: context.worktree,
})
if (r.status !== 0) {
return `⚠️ spec_status failed (exit ${r.status}): ${r.stderr}`
}
return r.stdout.trim()
},
})