Skip to content
Merged
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
13 changes: 13 additions & 0 deletions src/specify_cli/integrations/cline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ def command_filename(self, template_name: str) -> str:
"""Cline uses hyphenated filenames (e.g. speckit-git-commit.md)."""
return format_cline_command_name(template_name) + ".md"

def build_command_invocation(self, command_name: str, args: str = "") -> str:
"""Cline installs hyphenated slash-commands (``/speckit-<name>``), so the
dispatch invocation must match. The inherited MarkdownIntegration default
builds the dotted ``/speckit.<name>``, which references a command Cline
never registered. Reuse the same hyphenation as command_filename /
the injected frontmatter name (see ``format_cline_command_name``),
mirroring the forge integration.
"""
invocation = "/" + format_cline_command_name(command_name)
if args:
invocation = f"{invocation} {args}"
return invocation

def process_template(self, *args, **kwargs):
"""Ensure shared templates render Cline command references with hyphens."""
kwargs.setdefault("invoke_separator", self.invoke_separator)
Expand Down
18 changes: 18 additions & 0 deletions tests/integrations/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,24 @@ def test_forge_extension_command_hyphenated(self):
== "/speckit-git-commit fix typo"
)

def test_cline_core_command_hyphenated(self):
"""Cline installs hyphenated slash-commands (/speckit-<name>), so the
dispatch invocation must be hyphenated too — not the dotted default it
would inherit from MarkdownIntegration."""
from specify_cli.integrations import get_integration
i = get_integration("cline")
assert i.build_command_invocation("speckit.plan") == "/speckit-plan"
assert i.build_command_invocation("plan") == "/speckit-plan"

def test_cline_extension_command_hyphenated(self):
from specify_cli.integrations import get_integration
i = get_integration("cline")
assert i.build_command_invocation("speckit.git.commit") == "/speckit-git-commit"
assert (
i.build_command_invocation("speckit.git.commit", "fix typo")
== "/speckit-git-commit fix typo"
)


class TestResolveCommandRefs:
"""Tests for __SPECKIT_COMMAND_<NAME>__ placeholder resolution."""
Expand Down