Skip to content

Commit ff07cc0

Browse files
刘一cursoragent
andcommitted
refactor(cursor-agent): express dispatch support via build_exec_args() instead of requires_cli
Co-authored-by: Cursor <[email protected]>
1 parent 595bcab commit ff07cc0

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎src/specify_cli/integrations/cursor_agent/__init__.py‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
Cursor Agent uses the ``.cursor/skills/speckit-<name>/SKILL.md`` layout.
44
Commands are deprecated; ``--skills`` defaults to ``True``.
55
6-
CLI dispatch via ``cursor-agent -p --trust <prompt>`` is supported so
7-
``specify workflow run`` can drive cursor-agent headlessly, in addition
8-
to the existing in-IDE skill flow.
6+
The IDE/skills flow is the primary path and works without the
7+
``cursor-agent`` CLI being installed (``requires_cli=False``). Workflow
8+
dispatch via ``cursor-agent -p --trust <prompt>`` is offered as an
9+
opt-in capability — the presence of ``build_exec_args()`` is what
10+
indicates dispatch support, mirroring ``CopilotIntegration``.
911
"""
1012

1113
from __future__ import annotations
@@ -20,7 +22,12 @@ class CursorAgentIntegration(SkillsIntegration):
2022
"folder": ".cursor/",
2123
"commands_subdir": "skills",
2224
"install_url": "https://docs.cursor.com/en/cli/overview",
23-
"requires_cli": True,
25+
# IDE-first integration: ``specify init --ai cursor-agent`` must
26+
# work without the ``cursor-agent`` CLI installed (the IDE flow
27+
# uses skills directly). Workflow dispatch additionally requires
28+
# the CLI on PATH, but that's enforced at dispatch time via
29+
# ``shutil.which`` rather than as a hard ``specify init`` precheck.
30+
"requires_cli": False,
2431
}
2532
registrar_config = {
2633
"dir": ".cursor/skills",
@@ -41,6 +48,13 @@ def build_exec_args(
4148
) -> list[str] | None:
4249
"""Build CLI arguments for non-interactive ``cursor-agent`` execution.
4350
51+
Always returns argv (no ``requires_cli`` guard) so workflow
52+
dispatch is supported even though the integration's ``config``
53+
sets ``requires_cli=False`` to keep the IDE-only flow unblocked.
54+
This mirrors ``CopilotIntegration``: dispatch support is signalled
55+
by overriding ``build_exec_args()``, not by the ``requires_cli``
56+
flag (which is reserved for the ``specify init`` precheck).
57+
4458
Mandatory headless flags:
4559
4660
* ``-p`` — print/headless mode (access to all tools)
@@ -62,8 +76,6 @@ def build_exec_args(
6276
either drops tool calls or exits non-zero on the first approval
6377
prompt.
6478
"""
65-
if not self.config or not self.config.get("requires_cli"):
66-
return None
6779
args = [self.key, "-p", "--trust", "--approve-mcps", "--force", prompt]
6880
if model:
6981
args.extend(["--model", model])

0 commit comments

Comments
 (0)