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/export-roundtrip.sh
View on GitHub#!/usr/bin/env bash
# export-roundtrip.sh - export a session as clean JSON and verify it round-trips.
#
# `opencode export <id>` prints a human line ("Exporting session: ...") to
# STDERR and the JSON document to STDOUT, so suppress stderr before piping to jq.
# The JSON shape is { info: {id, slug, projectID, directory, title, tokens,
# time, ...}, messages: [...] }.
#
# Usage:
# export-roundtrip.sh ses_3a4e22ad5ffebMKLt0tL7exPjZ # prints clean JSON
# export-roundtrip.sh --self-test
#
# Tip: redirect to a file for archival: export-roundtrip.sh <id> > session.json
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "$SCRIPT_DIR/lib/common.sh"
oqa_export() {
local id="$1" out
out="$(mktemp -t oqa-export.XXXXXX)" || return 1
OQA_TMPDIRS+=("$out")
oqa_export_to_file "$id" "$out" || return 1
oqa_validate_export_file "$id" "$out" || return 1
cat "$out"
}
oqa_extract_json_stdout() {
local raw="$1" clean="$2"
awk '
BEGIN { started = 0 }
started { print; next }
{
pos = index($0, "{")
if (pos > 0) {
print substr($0, pos)
started = 1
}
}
' "$raw" >"$clean"
}
oqa_export_to_file() {
local id="$1" out="$2" raw
if [ -z "$id" ]; then
oqa_log "FAIL: missing session id"
return 2
fi
raw="$(mktemp -t oqa-export-raw.XXXXXX)" || return 1
OQA_TMPDIRS+=("$raw")
opencode export "$id" >"$raw" 2>/dev/null || return 1
oqa_extract_json_stdout "$raw" "$out"
}
oqa_validate_export_file() {
local id="$1" file="$2" got title msgtype
if ! jq -e . "$file" >/dev/null 2>&1; then
oqa_log "FAIL: export stdout is not valid JSON for $id"
return 1
fi
got="$(jq -r '.info.id // empty' "$file")"
if [ "$got" != "$id" ]; then
oqa_log "FAIL: export .info.id '$got' != '$id'"
return 1
fi
title="$(jq -r '.info.title|type' "$file" 2>/dev/null)"
msgtype="$(jq -r '.messages|type' "$file" 2>/dev/null)"
if [ "$title" = "string" ] && { [ "$msgtype" = "array" ] || [ "$msgtype" = "null" ]; }; then
return 0
fi
oqa_log "FAIL: unexpected shape (title=$title messages=$msgtype)"
return 1
}
oqa_self_test() {
oqa_require opencode jq || return 1
local id out
id="$(oqa_db_query "SELECT id FROM session ORDER BY time_created DESC LIMIT 1" | jq -r '.[0].id // empty')"
if [ -z "$id" ]; then oqa_log "FAIL: no sessions to export"; return 1; fi
out="$(mktemp -t oqa-export.XXXXXX)" || return 1
OQA_TMPDIRS+=("$out")
oqa_export_to_file "$id" "$out" || return 1
oqa_validate_export_file "$id" "$out" || return 1
oqa_pass "export round-trips $id (info.id matches, valid JSON)"
}
case "${1:-}" in
--self-test) oqa_self_test; exit $? ;;
-h|--help|"")
sed -n '2,16p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'
[ -z "${1:-}" ] && exit 2 || exit 0 ;;
*)
oqa_require opencode jq || exit 1
oqa_export "$1" ;;
esac
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: 319k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 319k | 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: 196k | Updated | Claude CodeCodex | Verified | Install |