11"""Tests for OpencodeIntegration."""
22
3+ from specify_cli .integrations import get_integration
4+
35from .test_integration_base_markdown import MarkdownIntegrationTests
46
57
@@ -9,3 +11,49 @@ class TestOpencodeIntegration(MarkdownIntegrationTests):
911 COMMANDS_SUBDIR = "command"
1012 REGISTRAR_DIR = ".opencode/command"
1113 CONTEXT_FILE = "AGENTS.md"
14+
15+ def test_build_exec_args_uses_run_command_dispatch (self ):
16+ integration = get_integration (self .KEY )
17+
18+ args = integration .build_exec_args (
19+ "/speckit.specify build a login page" ,
20+ output_json = False ,
21+ )
22+
23+ assert args == [
24+ "opencode" ,
25+ "run" ,
26+ "--command" ,
27+ "speckit.specify" ,
28+ "build a login page" ,
29+ ]
30+ assert "-p" not in args
31+ assert "--output-format" not in args
32+
33+ def test_build_exec_args_maps_model_and_json_flags (self ):
34+ integration = get_integration (self .KEY )
35+
36+ args = integration .build_exec_args (
37+ "/speckit.plan add OAuth" ,
38+ model = "anthropic/claude-sonnet-4" ,
39+ output_json = True ,
40+ )
41+
42+ assert args == [
43+ "opencode" ,
44+ "run" ,
45+ "--command" ,
46+ "speckit.plan" ,
47+ "-m" ,
48+ "anthropic/claude-sonnet-4" ,
49+ "--format" ,
50+ "json" ,
51+ "add OAuth" ,
52+ ]
53+
54+ def test_build_exec_args_keeps_plain_prompt_dispatch (self ):
55+ integration = get_integration (self .KEY )
56+
57+ args = integration .build_exec_args ("explain this repository" , output_json = False )
58+
59+ assert args == ["opencode" , "run" , "explain this repository" ]
0 commit comments