code-yeongyu/oh-my-openagent / .agents/skills/opencode-qa
opencode-qa
VerifiedQA opencode itself, per case: verify the CLI/terminal (opencode run, db, serve, export), prove a specific plugin hook/action/event fired via the SSE event stream, smoke-test the TUI under tmux, and investigate sessions in opencode's SQLite DB by id, title/name, or message text. Ships tested helper scripts (each with a --self-test) plus per-domain references. Use whenever someone wants to QA, smoke-test, verify, or debug opencode's CLI, HTTP server, plugin hooks/events, or TUI, or to find/inspect opencode sessions in the database. Triggers: opencode qa, qa opencode, test opencode, verify opencode hook, opencode session db, find opencode session by id/name/text, opencode tui test, opencode server health, opencode event stream.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.3 KB |
| references/cli-commands.md | markdown | 3.8 KB |
| references/db-investigation.md | markdown | 5.8 KB |
| references/docker-qa.md | markdown | 3.2 KB |
| references/events-hooks.md | markdown | 4.5 KB |
| references/sdk.md | markdown | 4.1 KB |
| references/server-api.md | markdown | 6.5 KB |
| references/testing-harness.md | markdown | 6.2 KB |
| references/tui-tmux.md | markdown | 4.0 KB |
| scripts/db-session-by-id.shexecutable | script | 1.7 KB |
| scripts/db-session-by-name.shexecutable | script | 1.9 KB |
| scripts/db-session-by-text.shexecutable | script | 6.6 KB |
| scripts/export-roundtrip.shexecutable | script | 2.8 KB |
| scripts/lib/common.shexecutable | script | 9.5 KB |
| scripts/lib/fake-openai-branches.mjs | script | 1.2 KB |
| scripts/lib/fake-openai-events.mjs | script | 2.3 KB |
| scripts/lib/fake-openai-server.mjsexecutable | script | 3.7 KB |
| scripts/lsp-e2e.shexecutable | script | 134.1 KB |
| scripts/serve-wake-split-probe.shexecutable | script | 38.2 KB |
| scripts/server-smoke.shexecutable | script | 2.1 KB |
| scripts/sse-hook-probe.shexecutable | script | 4.4 KB |
| scripts/tui-smoke.shexecutable | script | 3.6 KB |
scripts/lib/fake-openai-server.mjs
View on GitHub#!/usr/bin/env node
import http from "node:http"
import fs from "node:fs"
import path from "node:path"
import os from "node:os"
import { sendSse, textEvents, toolCallEvents, appendLog } from "./fake-openai-events.mjs"
import { branchCounts, latches, selectBranch } from "./fake-openai-branches.mjs"
const requestedPort = Number(process.env.FAKE_OPENAI_PORT ?? 0)
const logFile = process.env.FAKE_LLM_LOG ?? path.join(os.tmpdir(), "fake-llm.log")
let callCount = 0
function logBranch(branch, extra = {}) {
const now = new Date().toISOString()
const line = `[${now}] branch=${branch} call=${callCount}${Object.keys(extra).length ? " " + JSON.stringify(extra) : ""}\n`
appendLog(logFile, line)
process.stdout.write(line)
}
function readBody(req) {
return new Promise((resolve, reject) => {
const chunks = []
req.on("data", (chunk) => chunks.push(chunk))
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")))
req.on("error", reject)
})
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
const server = http.createServer(async (req, res) => {
if (req.method === "GET" && req.url === "/health") {
res.writeHead(200, { "content-type": "text/plain" }).end("ok")
return
}
if (req.method !== "POST" || !req.url?.includes("/responses")) {
res.writeHead(404, { "content-type": "application/json" }).end(JSON.stringify({ error: "not found" }))
return
}
callCount++
const raw = await readBody(req)
let body
try {
body = JSON.parse(raw)
} catch {
body = {}
}
const inputStr = JSON.stringify(body.input ?? body.messages ?? body)
const branch = selectBranch(inputStr)
branchCounts[branch] = (branchCounts[branch] ?? 0) + 1
logBranch(branch)
if (branch === "title") {
sendSse(res, textEvents(callCount, "wake split probe session"))
return
}
if (branch === "child") {
sendSse(res, textEvents(callCount, "DONE"))
return
}
if (branch === "wake") {
await sleep(3000)
sendSse(res, textEvents(callCount, `WAKE_ACK ${callCount}`))
return
}
if (branch === "parent-tool-call") {
latches.parentToolCallIssued = true
sendSse(
res,
toolCallEvents(callCount, "task", `call_agent_${callCount}`, {
description: "split probe child",
prompt: "SPLIT_CHILD_TASK: reply exactly DONE",
subagent_type: "explore",
run_in_background: true,
load_skills: [],
}),
)
return
}
if (branch === "parent-hold") {
latches.parentHoldIssued = true
sendSse(
res,
toolCallEvents(callCount, "bash", `call_bash_${callCount}`, {
command: "i=0; while [ $i -lt 8 ]; do i=$((i+1)); sleep 1; done",
description: "hold turn",
}),
)
return
}
if (inputStr.includes("say exactly: TUI_NOREG_OK")) {
sendSse(res, textEvents(callCount, "TUI_NOREG_OK"))
return
}
sendSse(res, textEvents(callCount, `fake response ${callCount}`))
})
function logFinalCounts() {
const summary = Object.entries(branchCounts)
.map(([k, v]) => `${k}=${v}`)
.join(" ")
const line = `[${new Date().toISOString()}] FINAL_COUNTS ${summary}\n`
appendLog(logFile, line)
process.stdout.write(line)
}
server.listen(requestedPort, "127.0.0.1", () => {
const addr = server.address()
const port = typeof addr === "object" && addr !== null ? addr.port : requestedPort
try {
fs.mkdirSync(path.dirname(logFile), { recursive: true })
appendLog(logFile, `[${new Date().toISOString()}] START port=${port}\n`)
} catch {}
process.stdout.write(`fake-openai listening on ${port}\n`)
})
process.on("SIGTERM", () => {
logFinalCounts()
server.close(() => process.exit(0))
})
process.on("SIGINT", () => {
logFinalCounts()
server.close(() => process.exit(0))
})
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |