Skip to content

Commit d39f8fd

Browse files
jawwad-aliclaude
andauthored
fix(integrations): Cline dispatches hyphenated /speckit-<cmd> invocations (#3622)
Cline installs its slash-commands with hyphenated names (speckit-plan, speckit-git-commit) via format_cline_command_name + the hyphenated command_filename, but ClineIntegration inherited MarkdownIntegration's build_command_invocation, which builds the dotted /speckit.<cmd> — a name Cline never registered. Add a build_command_invocation override reusing format_cline_command_name, producing /speckit-<name>, mirroring the ForgeIntegration fix. Cline was the only remaining markdown integration with invoke_separator='-' + hyphenated command_filename that lacked the override. Tests assert Cline core + extension invocations are hyphenated, incl. args (fail before: dotted /speckit.plan / /speckit.git.commit). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 914d7b8 commit d39f8fd

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/specify_cli/integrations/cline/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ def command_filename(self, template_name: str) -> str:
7777
"""Cline uses hyphenated filenames (e.g. speckit-git-commit.md)."""
7878
return format_cline_command_name(template_name) + ".md"
7979

80+
def build_command_invocation(self, command_name: str, args: str = "") -> str:
81+
"""Cline installs hyphenated slash-commands (``/speckit-<name>``), so the
82+
dispatch invocation must match. The inherited MarkdownIntegration default
83+
builds the dotted ``/speckit.<name>``, which references a command Cline
84+
never registered. Reuse the same hyphenation as command_filename /
85+
the injected frontmatter name (see ``format_cline_command_name``),
86+
mirroring the forge integration.
87+
"""
88+
invocation = "/" + format_cline_command_name(command_name)
89+
if args:
90+
invocation = f"{invocation} {args}"
91+
return invocation
92+
8093
def process_template(self, *args, **kwargs):
8194
"""Ensure shared templates render Cline command references with hyphens."""
8295
kwargs.setdefault("invoke_separator", self.invoke_separator)

tests/integrations/test_base.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ def test_forge_extension_command_hyphenated(self):
236236
== "/speckit-git-commit fix typo"
237237
)
238238

239+
def test_cline_core_command_hyphenated(self):
240+
"""Cline installs hyphenated slash-commands (/speckit-<name>), so the
241+
dispatch invocation must be hyphenated too — not the dotted default it
242+
would inherit from MarkdownIntegration."""
243+
from specify_cli.integrations import get_integration
244+
i = get_integration("cline")
245+
assert i.build_command_invocation("speckit.plan") == "/speckit-plan"
246+
assert i.build_command_invocation("plan") == "/speckit-plan"
247+
248+
def test_cline_extension_command_hyphenated(self):
249+
from specify_cli.integrations import get_integration
250+
i = get_integration("cline")
251+
assert i.build_command_invocation("speckit.git.commit") == "/speckit-git-commit"
252+
assert (
253+
i.build_command_invocation("speckit.git.commit", "fix typo")
254+
== "/speckit-git-commit fix typo"
255+
)
256+
239257

240258
class TestResolveCommandRefs:
241259
"""Tests for __SPECKIT_COMMAND_<NAME>__ placeholder resolution."""

0 commit comments

Comments
 (0)