fix: dispatch opencode commands via run (#2410)

This commit is contained in:
Andrii Furmanets
2026-04-29 17:39:45 +03:00
committed by GitHub
parent 1049e17a43
commit c079b2cc32
2 changed files with 72 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
"""Tests for OpencodeIntegration."""
from specify_cli.integrations import get_integration
from .test_integration_base_markdown import MarkdownIntegrationTests
@@ -9,3 +11,49 @@ class TestOpencodeIntegration(MarkdownIntegrationTests):
COMMANDS_SUBDIR = "command"
REGISTRAR_DIR = ".opencode/command"
CONTEXT_FILE = "AGENTS.md"
def test_build_exec_args_uses_run_command_dispatch(self):
integration = get_integration(self.KEY)
args = integration.build_exec_args(
"/speckit.specify build a login page",
output_json=False,
)
assert args == [
"opencode",
"run",
"--command",
"speckit.specify",
"build a login page",
]
assert "-p" not in args
assert "--output-format" not in args
def test_build_exec_args_maps_model_and_json_flags(self):
integration = get_integration(self.KEY)
args = integration.build_exec_args(
"/speckit.plan add OAuth",
model="anthropic/claude-sonnet-4",
output_json=True,
)
assert args == [
"opencode",
"run",
"--command",
"speckit.plan",
"-m",
"anthropic/claude-sonnet-4",
"--format",
"json",
"add OAuth",
]
def test_build_exec_args_keeps_plain_prompt_dispatch(self):
integration = get_integration(self.KEY)
args = integration.build_exec_args("explain this repository", output_json=False)
assert args == ["opencode", "run", "explain this repository"]