Motivation
A frequently requested workflow: "have OpenCode write or extend tests for this diff / this file / this module" as a first-class command, not a hand-crafted rescue prompt. This complements the existing review flow — review finds issues, test writes regression coverage.
Proposed UX
/opencode:test # tests for current diff
/opencode:test --path src/auth # tests for a specific module
/opencode:test --file scripts/foo.mjs # tests for a specific file
/opencode:test --run # generate, then run the test suite and iterate
Implementation sketch
- New command
plugins/opencode/commands/test.md.
- New prompt template
prompts/test.md that instructs OpenCode to: infer the test framework (Vitest/Jest/node:test/etc.) from package.json, find co-located or parallel test files, write tests matching the project's existing style, and run them when --run is set.
- Handler builds the same
git diff context as review when no --path/--file is given, then dispatches under the build agent (write-capable).
- Returns a summary of tests written + pass/fail if
--run was set.
Upstream reference
Derived from openai/codex-plugin-cc#205.
Motivation
A frequently requested workflow: "have OpenCode write or extend tests for this diff / this file / this module" as a first-class command, not a hand-crafted rescue prompt. This complements the existing review flow — review finds issues, test writes regression coverage.
Proposed UX
Implementation sketch
plugins/opencode/commands/test.md.prompts/test.mdthat instructs OpenCode to: infer the test framework (Vitest/Jest/node:test/etc.) frompackage.json, find co-located or parallel test files, write tests matching the project's existing style, and run them when--runis set.git diffcontext as review when no--path/--fileis given, then dispatches under thebuildagent (write-capable).--runwas set.Upstream reference
Derived from openai/codex-plugin-cc#205.