Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/specify_cli/integrations/cursor_agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ def build_exec_args(
either drops tool calls or exits non-zero on the first approval
prompt.
"""
args = [self.key, "-p", "--trust", "--approve-mcps", "--force", prompt]
args = [
self._resolve_executable(),
"-p",
"--trust",
"--approve-mcps",
"--force",
prompt,
]
self._apply_extra_args_env_var(args)
if model:
args.extend(["--model", model])
if output_json:
Expand Down
32 changes: 32 additions & 0 deletions tests/integrations/test_integration_cursor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,38 @@ def test_build_exec_args_supports_dispatch_without_requires_cli(self):
assert argv is not None
assert argv[0] == "cursor-agent"

def test_build_exec_args_honors_executable_override(self, monkeypatch):
"""``SPECKIT_INTEGRATION_CURSOR_AGENT_EXECUTABLE`` overrides argv[0].

Every other CLI-dispatch integration (codex, devin, ...) routes
argv[0] through ``_resolve_executable()`` so operators can pin a
binary path (issue #2596). cursor-agent hardcoded ``self.key`` and
silently ignored the documented override.
"""
monkeypatch.setenv(
"SPECKIT_INTEGRATION_CURSOR_AGENT_EXECUTABLE", "/custom/cursor"
)
i = get_integration("cursor-agent")
args = i.build_exec_args("/speckit-plan", output_json=False)
assert args[0] == "/custom/cursor"
# The mandatory headless flags must still be present.
for flag in ("-p", "--trust", "--approve-mcps", "--force"):
assert flag in args

def test_build_exec_args_honors_extra_args_override(self, monkeypatch):
"""``SPECKIT_INTEGRATION_CURSOR_AGENT_EXTRA_ARGS`` flags are injected.

The ``_apply_extra_args_env_var()`` hook (issue #2595) was never
invoked by cursor-agent, so operator-supplied flags were dropped.
"""
monkeypatch.setenv(
"SPECKIT_INTEGRATION_CURSOR_AGENT_EXTRA_ARGS", "--foo bar"
)
i = get_integration("cursor-agent")
args = i.build_exec_args("/speckit-plan", output_json=False)
assert "--foo" in args
assert "bar" in args
Comment on lines +155 to +158

def test_build_command_invocation_uses_hyphenated_skill_name(self):
"""SkillsIntegration: /speckit-plan (not /speckit.plan)."""
i = get_integration("cursor-agent")
Expand Down
Loading