1- """Tests for the per-integration `SPECIFY_ <KEY>_EXTRA_ARGS` env-var hook.
1+ """Tests for the per-integration `SPECIFY_INTEGRATION_ <KEY>_EXTRA_ARGS` env-var hook.
22
33The hook is implemented in `IntegrationBase._apply_extra_args_env_var`
44and wired into every concrete `build_exec_args` —
@@ -79,10 +79,12 @@ class _NoCliStub(SkillsIntegration):
7979
8080@pytest .fixture (autouse = True )
8181def _clean_extra_args_env (monkeypatch ):
82- """Strip any leaked SPECIFY_ *_EXTRA_ARGS from the test env so a
83- developer's shell setting doesn't pollute results."""
82+ """Strip any leaked SPECIFY_INTEGRATION_ *_EXTRA_ARGS from the test
83+ env so a developer's shell setting doesn't pollute results."""
8484 for key in list (os .environ ):
85- if key .startswith ("SPECIFY_" ) and key .endswith ("_EXTRA_ARGS" ):
85+ if key .startswith ("SPECIFY_INTEGRATION_" ) and key .endswith (
86+ "_EXTRA_ARGS"
87+ ):
8688 monkeypatch .delenv (key , raising = False )
8789
8890
@@ -100,7 +102,7 @@ def test_env_var_set_flag_inserted_before_model_and_output_format(
100102 monkeypatch ,
101103):
102104 monkeypatch .setenv (
103- "SPECIFY_CLAUDE_EXTRA_ARGS " , "--dangerously-skip-permissions"
105+ "SPECIFY_INTEGRATION_CLAUDE_EXTRA_ARGS " , "--dangerously-skip-permissions"
104106 )
105107 args = _ClaudeStub ().build_exec_args ("hello prompt" , model = "sonnet" )
106108 assert args == [
@@ -117,7 +119,7 @@ def test_env_var_set_flag_inserted_before_model_and_output_format(
117119
118120def test_env_var_multi_token_parsed_via_shlex (monkeypatch ):
119121 monkeypatch .setenv (
120- "SPECIFY_CLAUDE_EXTRA_ARGS " ,
122+ "SPECIFY_INTEGRATION_CLAUDE_EXTRA_ARGS " ,
121123 "--dangerously-skip-permissions --max-turns 3" ,
122124 )
123125 args = _ClaudeStub ().build_exec_args ("p" )
@@ -135,24 +137,24 @@ def test_env_var_multi_token_parsed_via_shlex(monkeypatch):
135137
136138def test_env_var_empty_or_whitespace_is_noop (monkeypatch ):
137139 """An env var set to '' or ' ' is treated as unset."""
138- monkeypatch .setenv ("SPECIFY_CLAUDE_EXTRA_ARGS " , " " )
140+ monkeypatch .setenv ("SPECIFY_INTEGRATION_CLAUDE_EXTRA_ARGS " , " " )
139141 args = _ClaudeStub ().build_exec_args ("p" )
140142 assert args == ["claude" , "-p" , "p" , "--output-format" , "json" ]
141143
142144
143145def test_other_integration_env_var_ignored (monkeypatch ):
144- """`SPECIFY_GEMINI_EXTRA_ARGS ` set must NOT leak into
146+ """`SPECIFY_INTEGRATION_GEMINI_EXTRA_ARGS ` set must NOT leak into
145147 Claude's argv (per-integration scoping)."""
146- monkeypatch .setenv ("SPECIFY_GEMINI_EXTRA_ARGS " , "--gemini-only-flag" )
148+ monkeypatch .setenv ("SPECIFY_INTEGRATION_GEMINI_EXTRA_ARGS " , "--gemini-only-flag" )
147149 args = _ClaudeStub ().build_exec_args ("p" )
148150 assert args == ["claude" , "-p" , "p" , "--output-format" , "json" ]
149151
150152
151153def test_key_normalization_hyphen_to_underscore_uppercase (monkeypatch ):
152- """`kiro-cli` key looks up `SPECIFY_KIRO_CLI_EXTRA_ARGS `
154+ """`kiro-cli` key looks up `SPECIFY_INTEGRATION_KIRO_CLI_EXTRA_ARGS `
153155 (hyphens replaced with underscores, then uppercased)."""
154156 monkeypatch .setenv (
155- "SPECIFY_KIRO_CLI_EXTRA_ARGS " , "--some-kiro-flag"
157+ "SPECIFY_INTEGRATION_KIRO_CLI_EXTRA_ARGS " , "--some-kiro-flag"
156158 )
157159 args = _KiroCliStub ().build_exec_args ("p" )
158160 assert args == [
@@ -168,7 +170,7 @@ def test_key_normalization_hyphen_to_underscore_uppercase(monkeypatch):
168170def test_requires_cli_false_returns_none (monkeypatch ):
169171 """`requires_cli: False` short-circuits to None — the env-var
170172 hook is never reached and no argv is built."""
171- monkeypatch .setenv ("SPECIFY_NO_CLI_EXTRA_ARGS " , "--should-not-appear" )
173+ monkeypatch .setenv ("SPECIFY_INTEGRATION_NO_CLI_EXTRA_ARGS " , "--should-not-appear" )
172174 assert _NoCliStub ().build_exec_args ("p" ) is None
173175
174176
@@ -186,7 +188,7 @@ def test_requires_cli_false_returns_none(monkeypatch):
186188def test_codex_integration_honours_extra_args (monkeypatch ):
187189 from specify_cli .integrations .codex import CodexIntegration
188190
189- monkeypatch .setenv ("SPECIFY_CODEX_EXTRA_ARGS " , "--sandbox read-only" )
191+ monkeypatch .setenv ("SPECIFY_INTEGRATION_CODEX_EXTRA_ARGS " , "--sandbox read-only" )
190192 args = CodexIntegration ().build_exec_args ("p" , model = "gpt-5" )
191193 assert args == [
192194 "codex" ,
@@ -203,15 +205,15 @@ def test_codex_integration_honours_extra_args(monkeypatch):
203205def test_devin_integration_honours_extra_args (monkeypatch ):
204206 from specify_cli .integrations .devin import DevinIntegration
205207
206- monkeypatch .setenv ("SPECIFY_DEVIN_EXTRA_ARGS " , "--no-confirm" )
208+ monkeypatch .setenv ("SPECIFY_INTEGRATION_DEVIN_EXTRA_ARGS " , "--no-confirm" )
207209 args = DevinIntegration ().build_exec_args ("p" )
208210 assert args == ["devin" , "-p" , "p" , "--no-confirm" ]
209211
210212
211213def test_opencode_integration_honours_extra_args (monkeypatch ):
212214 from specify_cli .integrations .opencode import OpencodeIntegration
213215
214- monkeypatch .setenv ("SPECIFY_OPENCODE_EXTRA_ARGS " , "--quiet" )
216+ monkeypatch .setenv ("SPECIFY_INTEGRATION_OPENCODE_EXTRA_ARGS " , "--quiet" )
215217 args = OpencodeIntegration ().build_exec_args ("p" )
216218 assert args == [
217219 "opencode" ,
@@ -231,13 +233,13 @@ def test_opencode_extra_args_cannot_clobber_prompt_derived_command(
231233 repeated-flag CLI semantics (last value typically takes precedence).
232234
233235 Locks against the regression where an operator setting
234- ``SPECIFY_OPENCODE_EXTRA_ARGS ="--command malicious"`` could redirect
236+ ``SPECIFY_INTEGRATION_OPENCODE_EXTRA_ARGS ="--command malicious"`` could redirect
235237 a slash-prefixed prompt to a different command.
236238 """
237239 from specify_cli .integrations .opencode import OpencodeIntegration
238240
239241 monkeypatch .setenv (
240- "SPECIFY_OPENCODE_EXTRA_ARGS " , "--command operator-override"
242+ "SPECIFY_INTEGRATION_OPENCODE_EXTRA_ARGS " , "--command operator-override"
241243 )
242244 args = OpencodeIntegration ().build_exec_args ("/speckit body text" )
243245 # Prompt-derived "--command speckit" appears AFTER the
@@ -262,7 +264,7 @@ def test_copilot_integration_honours_extra_args(monkeypatch):
262264 # Disable --yolo so the argv shape stays deterministic.
263265 monkeypatch .setenv ("SPECKIT_COPILOT_ALLOW_ALL_TOOLS" , "0" )
264266 monkeypatch .setenv (
265- "SPECIFY_COPILOT_EXTRA_ARGS " , "--allow-tool 'shell(echo)'"
267+ "SPECIFY_INTEGRATION_COPILOT_EXTRA_ARGS " , "--allow-tool 'shell(echo)'"
266268 )
267269 args = CopilotIntegration ().build_exec_args ("p" )
268270 assert args == [
@@ -308,7 +310,7 @@ class _Result:
308310
309311def test_copilot_dispatch_command_includes_extra_args (monkeypatch ):
310312 """Locks the bypass fix: `CopilotIntegration.dispatch_command`
311- must honour `SPECIFY_COPILOT_EXTRA_ARGS `, not just `build_exec_args`.
313+ must honour `SPECIFY_INTEGRATION_COPILOT_EXTRA_ARGS `, not just `build_exec_args`.
312314 """
313315 import subprocess
314316
@@ -318,7 +320,7 @@ def test_copilot_dispatch_command_includes_extra_args(monkeypatch):
318320 monkeypatch .setattr (subprocess , "run" , capture )
319321 monkeypatch .setenv ("SPECKIT_COPILOT_ALLOW_ALL_TOOLS" , "0" )
320322 monkeypatch .setenv (
321- "SPECIFY_COPILOT_EXTRA_ARGS " , "--allow-tool 'shell(echo)'"
323+ "SPECIFY_INTEGRATION_COPILOT_EXTRA_ARGS " , "--allow-tool 'shell(echo)'"
322324 )
323325
324326 CopilotIntegration ().dispatch_command (
@@ -346,7 +348,7 @@ def test_codex_dispatch_command_includes_extra_args(monkeypatch):
346348
347349 capture = _RunCapture ()
348350 monkeypatch .setattr (subprocess , "run" , capture )
349- monkeypatch .setenv ("SPECIFY_CODEX_EXTRA_ARGS " , "--sandbox read-only" )
351+ monkeypatch .setenv ("SPECIFY_INTEGRATION_CODEX_EXTRA_ARGS " , "--sandbox read-only" )
350352
351353 CodexIntegration ().dispatch_command (
352354 "speckit.plan" , args = "body" , stream = False
0 commit comments