Skip to content

Commit 5a046ab

Browse files
authored
fix(integrations): drop invalid --model/--output-format flags from Vibe dispatch (#4784)
The Mistral Vibe CLI has no --model and no --output-format flag, so the inherited SkillsIntegration.build_exec_args() made a dispatched step exit 2 at argument parsing whenever a model was configured or JSON output was requested. Keep -p, map output_json to Vibe's own --output json, and drop model: Vibe picks its model from active_model in its config. Assisted-by: Claude Code (model: Claude Opus 5.5, autonomous)
1 parent 5b58439 commit 5a046ab

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from __future__ import annotations
88

9+
from collections.abc import Mapping, Sequence
910
from pathlib import Path
1011
from typing import Any
1112

@@ -79,6 +80,33 @@ def options(cls) -> list[IntegrationOption]:
7980
)
8081
return opts
8182

83+
def build_exec_args(
84+
self,
85+
prompt: str,
86+
*,
87+
model: str | None = None,
88+
output_json: bool = True,
89+
integration_args: Sequence[str] | None = None,
90+
integration_options: Mapping[str, Any] | None = None,
91+
project_root: Path | None = None,
92+
) -> list[str] | None:
93+
"""Build CLI arguments for non-interactive ``vibe`` execution.
94+
95+
``SkillsIntegration``'s default appends ``--model`` and
96+
``--output-format``, neither of which exists in the Vibe CLI, so a
97+
dispatched step exits 2 at argument parsing whenever either flag ends
98+
up appended (a configured ``model``, or ``output_json=True``). Vibe's
99+
structured output is ``--output json``. ``model`` is deliberately
100+
dropped: Vibe has no per-invocation model flag and selects its model
101+
out of band via ``active_model`` in its config (or ``VIBE_ACTIVE_MODEL``).
102+
"""
103+
self.validate_runtime_config(integration_args, integration_options)
104+
args = [self._resolve_executable(), "-p", prompt]
105+
self._apply_extra_args_env_var(args)
106+
if output_json:
107+
args.extend(["--output", "json"])
108+
return args
109+
82110
def _render_skill(self, template_name: str, frontmatter: dict[str, Any], body: str) -> str:
83111
"""Render a processed command template as a Vibe skill."""
84112
skill_name = f"speckit-{template_name.replace('.', '-')}"

‎tests/integrations/test_integration_vibe.py‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,54 @@ def test_skills_do_not_have_argument_hint(self, tmp_path):
128128
f"{f.parent.name}/SKILL.md unexpectedly has argument-hint frontmatter"
129129
)
130130

131+
def test_build_exec_args_uses_prompt_mode(self):
132+
integration = get_integration("vibe")
133+
134+
args = integration.build_exec_args(
135+
"/speckit-specify build a login page",
136+
output_json=False,
137+
)
138+
139+
assert args == ["vibe", "-p", "/speckit-specify build a login page"]
140+
141+
def test_build_exec_args_requests_json_output(self):
142+
"""Vibe's structured output is `--output json`; it has no `--output-format`."""
143+
integration = get_integration("vibe")
144+
145+
args = integration.build_exec_args("/speckit-plan add OAuth", output_json=True)
146+
147+
assert args == ["vibe", "-p", "/speckit-plan add OAuth", "--output", "json"]
148+
assert "--output-format" not in args
149+
150+
def test_build_exec_args_omits_model_flag(self):
151+
"""Vibe has no model flag; passing `--model` exits 2 at argument parsing."""
152+
integration = get_integration("vibe")
153+
154+
args = integration.build_exec_args(
155+
"explain this repository",
156+
model="mistral-medium-latest",
157+
output_json=False,
158+
)
159+
160+
assert args == ["vibe", "-p", "explain this repository"]
161+
assert "--model" not in args
162+
assert "mistral-medium-latest" not in args
163+
164+
def test_build_exec_args_applies_extra_args(self, monkeypatch):
165+
monkeypatch.setenv("SPECKIT_INTEGRATION_VIBE_EXTRA_ARGS", "--auto-approve")
166+
integration = get_integration("vibe")
167+
168+
args = integration.build_exec_args("check the build", output_json=True)
169+
170+
assert args == [
171+
"vibe",
172+
"-p",
173+
"check the build",
174+
"--auto-approve",
175+
"--output",
176+
"json",
177+
]
178+
131179

132180
class TestVibeTomlMerging:
133181
"""Behavioral tests for the toml-vibe hooks.toml generation and cleanup."""

0 commit comments

Comments
 (0)