← 返回列表
全部 Skill›工具 Tools›opencode-qa

opencode-qa

作者 @code-yeongyu · 语言 en
QA 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.
工具 Tools命令行工具通用执行命令访问网络待翻译
最近源活动
—
检测 SKILL.md 语言
en
星标 ★
71,009
分支 Fork
0
安装选项
提示
指令
使用 AI 助手安装
将下面的提示复制到你正在使用的 AI 助手中。
下载完整 Skill 目录(含全部配套文件)。 下载压缩包 ↓
SKILL.md 原文预览

opencode QA

QA the opencode coding agent itself. This skill maps each QA need to a tested

helper script and a deep reference. Every script ships a --self-test that

asserts its scenario against the live machine, so the scripts are both the QA

tools and their own regression checks.

Verified against opencode v1.17.7 (bun 1.3.12, macOS). Confirm the installed

version with opencode --version; the surface is stable but always sanity

check a flag with opencode <cmd> --help.

Golden rules (read before running anything)

  • READS of the live DB are safe and intended. Investigating sessions (Case D)

only reads ~/.local/share/opencode/opencode.db.

  • Anything that SPAWNS opencode (serve, run, the TUI) must use an isolated XDG

sandbox so QA never writes junk sessions into the real DB. The bundled

scripts already do this; if you run opencode by hand for QA, set

XDG_DATA_HOME / XDG_CONFIG_HOME / XDG_STATE_HOME / XDG_CACHE_HOME to

temp dirs first.

  • Global text search over the part table is a multi-GB scan. Always scope it

(--session, --recent, or --since). The text script refuses an

unbounded scan on purpose.

  • The opencode source repo (packages/opencode) tests itself with bun test

and CANNOT run tests from the repo root. See references/testing-harness.md.

Setup

Scripts live next to this file under scripts/. Invoke them from this skill

directory (or with their absolute path):

cd <this-skill-dir>                        # .agents/skills/opencode-qa
bash scripts/lib/common.sh --self-check    # confirm the harness + deps

Docker is the default QA surface. Run QA inside a disposable container that

has the latest opencode and a copy of your config, with the host untouched:

script/agent/qa-docker.sh (see references/docker-qa.md).

The local scripts below are the fallback for when Docker is unavailable or on

Windows.

common.sh provides the shared harness (DB path, SQL escaping, isolated XDG

sandbox, free port, server start/stop, and an EXIT-trap cleanup). It requires

opencode, sqlite3, curl, jq, and tmux on PATH.

Router: pick your case

| You want to... | Case | Script | Reference |

|---|---|---|---|

| Run opencode non-interactively / check a CLI command | A | opencode run --format json (inline) | references/cli-commands.md |

| Find a session by its id | D | scripts/db-session-by-id.sh <ses_id> | references/db-investigation.md |

| Find sessions by title/name | D | scripts/db-session-by-name.sh "<text>" | references/db-investigation.md |

| Find sessions by message text | D | scripts/db-session-by-text.sh --recent N "<text>" | references/db-investigation.md |

| Export a whole session as JSON | D | scripts/export-roundtrip.sh <ses_id> | references/db-investigation.md |

| Check the HTTP server / an endpoint | B | scripts/server-smoke.sh | references/server-api.md |

| Prove a hook / action / event fired | B | scripts/sse-hook-probe.sh | references/events-hooks.md |

| Prove serve-topology wake runner-split (reproduced/fixed) | B | scripts/serve-wake-split-probe.sh --expect reproduced\|fixed --evidence-dir DIR (self-test: --self-test; fake LLM: scripts/lib/fake-openai-server.mjs) | references/events-hooks.md |

| Smoke-test the TUI | C | scripts/tui-smoke.sh | references/tui-tmux.md |

| Write/run a test in the opencode source | - | (bun test) | references/testing-harness.md |

| Drive opencode from a Bun/TS script | - | (SDK) | references/sdk.md |

Case A: CLI / terminal works

The canonical scriptable, non-interactive entry is opencode run. JSON mode

emits one event per line so you can assert on it.

# stream structured events (types: text, tool_use, step_start, step_finish, reasoning, error)
opencode run "list files in src" --format json
# run a slash command
opencode run --command commit
# resume the last session
opencode run -c "continue"
# target an already-running server instead of booting one
opencode run "explain auth" --attach http://127.0.0.1:4096 -p "$OPENCODE_SERVER_PASSWORD"

Other QA-useful commands: opencode db path, opencode debug paths,

opencode session list --format json, opencode models --verbose. Full flag

detail in references/cli-commands.md.

Case B: a specific hook, action, or event

opencode publishes lifecycle events over Server-Sent Events at GET /event.

Plugins observe the same events via the event hook, so seeing an event on the

wire proves a hook would fire.

# prove the SSE plumbing works (isolated server, asserts server.connected)
bash scripts/sse-hook-probe.sh --self-test

# watch a REAL server for a specific event while you trigger an action
bash scripts/sse-hook-probe.sh --attach http://127.0.0.1:4096 \
  --password "$OPENCODE_SERVER_PASSWORD" --directory "$PWD" \
  --event message.part.updated --timeout 30

Trigger an action over HTTP (fire-and-forget so the stream is not blocked):

curl -X POST -u opencode:$OPENCODE_SERVER_PASSWORD -H 'Content-Type: application/json' \
  -d '{"parts":[{"type":"text","text":"say hi"}]}' \
  "http://127.0.0.1:4096/session/<ses_id>/prompt_async?directory=$PWD"

A real prom

评论
Ccode-yeongyu
code-yeongyu
code-yeongyu/oh-my-openagent
查看 GitHub 仓库 查看作者的其他 Skill
来源信息
作者@code-yeongyu
所属大类工具 Tools / 命令行工具
国内可用性通用
最近源活动—
风险提示执行命令、访问网络
提示:风险标签为程序静态扫描结果,仅作提示,不代表安全认证。安装前请阅读 SKILL.md 及其引用的脚本、权限,自行判断是否可信。