Skip to content

code-yeongyu/oh-my-openagent / .agents/skills/opencode-qa

opencode-qa

Verified

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.

FileKindSize
SKILL.mdskill md11.3 KB
references/cli-commands.mdmarkdown3.8 KB
references/db-investigation.mdmarkdown5.8 KB
references/docker-qa.mdmarkdown3.2 KB
references/events-hooks.mdmarkdown4.5 KB
references/sdk.mdmarkdown4.1 KB
references/server-api.mdmarkdown6.5 KB
references/testing-harness.mdmarkdown6.2 KB
references/tui-tmux.mdmarkdown4.0 KB
scripts/db-session-by-id.shexecutablescript1.7 KB
scripts/db-session-by-name.shexecutablescript1.9 KB
scripts/db-session-by-text.shexecutablescript6.6 KB
scripts/export-roundtrip.shexecutablescript2.8 KB
scripts/lib/common.shexecutablescript9.5 KB
scripts/lib/fake-openai-branches.mjsscript1.2 KB
scripts/lib/fake-openai-events.mjsscript2.3 KB
scripts/lib/fake-openai-server.mjsexecutablescript3.7 KB
scripts/lsp-e2e.shexecutablescript134.1 KB
scripts/serve-wake-split-probe.shexecutablescript38.2 KB
scripts/server-smoke.shexecutablescript2.1 KB
scripts/sse-hook-probe.shexecutablescript4.4 KB
scripts/tui-smoke.shexecutablescript3.6 KB

references/cli-commands.md

View on GitHub
# opencode CLI for QA (Case A: terminal works)

The installed binary is `opencode` (v1.15.13). From the source repo you can also run `bun run --conditions=browser ./src/index.ts <cmd>` inside `packages/opencode`. The canonical non-interactive QA entry is `opencode run --format json`.

## Global flags

```
--print-logs
--log-level DEBUG|INFO|WARN|ERROR
--pure                    (run without external plugins)
-h, --help
-v, --version
```

## `opencode run` (non-interactive QA core)

Positional message. Key flags:

```
-m, --model <provider/model>
--agent <name>
-s, --session <ses_...>
-c, --continue
--fork
--format default|json
-f, --file <path>
--title
--attach <url>
-p, --password
-u, --username
--dir
--variant
--thinking
-i, --interactive
--dangerously-skip-permissions
--command <slash-cmd>
```

`--format json` emits NDJSON, one JSON object per line, each shaped like:

```json
{"type":"...", "timestamp":<ms>, "sessionID":"ses_...", ...}
```

`type` is one of: `text`, `tool_use`, `step_start`, `step_finish`, `reasoning`, `error`. The process exits when the session goes idle.

Validation rules:

- `-i` cannot combine with `--command` or `--format json`
- `--fork` needs `-c` or `-s`

Examples:

```bash
opencode run "list the files in src" --format json
```

```bash
opencode run --command commit
```

```bash
opencode run -c "continue the previous task"
```

```bash
opencode run "explain auth" --attach http://127.0.0.1:4096 -p "$OPENCODE_SERVER_PASSWORD"
```

## `opencode db` (database tools)

```bash
opencode db path
```

Prints the active DB file path.

```bash
opencode db "<SQL>" --format json
```

Runs a query and prints JSON rows. Use `--format tsv` (default) for TSV output.

```bash
opencode db
```

Opens an interactive sqlite3 shell.

```bash
opencode db migrate
```

Migrates legacy JSON storage into SQLite.

Bundled scripts for session investigation:

- `scripts/db-session-by-id.sh`
- `scripts/db-session-by-name.sh`
- `scripts/db-session-by-text.sh`
- `scripts/export-roundtrip.sh`

Full detail in `references/db-investigation.md`.

## `opencode session`

```bash
opencode session list --format json
```

Lists sessions as JSON.

```bash
opencode session delete <ses_id>
```

Deletes one session.

## `opencode export [sessionID]`

Prints "Exporting session: ..." to STDERR and a clean JSON document `{info:{...}, messages:[...]}` to STDOUT. Always redirect STDERR before piping to jq.

Example:

```bash
opencode export ses_3a4e... 2>/dev/null | jq '.info.id'
```

Bundled wrapper:

```bash
scripts/export-roundtrip.sh <ses_id>
```

## `opencode serve`

Starts a headless HTTP server.

Flags:

```
--port            (0 = pick 4096 then a free port)
--hostname        (default 127.0.0.1)
--mdns
--mdns-domain
--cors
```

On start it prints:

```
opencode server listening on http://<host>:<port>
```

Set `OPENCODE_SERVER_PASSWORD` to require auth. See `references/server-api.md`.

Bundled smoke test:

```bash
scripts/server-smoke.sh
```

## `opencode debug`

Useful subcommands:

```bash
opencode debug paths    # data/config/cache/state dirs
opencode debug info     # version, OS, terminal, plugins
```

Others: `config`, `lsp`, `ripgrep`, `file`, `skill`, `snapshot`, `agent`, `v2`, `wait`.

## Other commands

```bash
opencode models [provider] --verbose
opencode stats
opencode providers list          # alias: auth
opencode mcp list
opencode generate                # prints the OpenAPI JSON spec
```

## Installed binary vs dev source (IMPORTANT note box)

The installed `opencode` (v1.15.13) matches the dev source in `packages/opencode`. When citing internals, cite dev source paths but always verify a flag against `opencode <cmd> --help` on the installed binary, since the dev branch can drift ahead.

For DB internals see `references/db-investigation.md`; for the HTTP server see `references/server-api.md`.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall