opencode-config/.opencode/tools/spec-status.ts
Sergey 1bd541f172
refactor: commands rename /run-pipeline + /spec (#29)
* refactor: rename /pipeline-driver to /run-pipeline + /spec-driver to /spec

- Rename command + skill dir + skill() ref for both
- Update cross-references in .opencode/ .md files
- pipeline_status / spec_status tool names unchanged (independent)
- Update project-map README

* docs(handoff): add pr-14 handoff + ADR-009

* docs(handoff): set PR number 29

---------

Co-authored-by: opencode-agent <agent@slaid098.dev>
2026-07-24 00:46:00 +03:00

22 lines
No EOL
891 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 the spec command. 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()
},
})