mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 12:28:06 +08:00
60 lines
1.6 KiB
Python
60 lines
1.6 KiB
Python
"""Tests for OpencodeIntegration."""
|
|
|
|
from specify_cli.integrations import get_integration
|
|
|
|
from .test_integration_base_markdown import MarkdownIntegrationTests
|
|
|
|
|
|
class TestOpencodeIntegration(MarkdownIntegrationTests):
|
|
KEY = "opencode"
|
|
FOLDER = ".opencode/"
|
|
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"]
|