From ed70eef79e3e25051c8f5d9c04d595daf066adf7 Mon Sep 17 00:00:00 2001 From: jawwad-ali Date: Wed, 22 Jul 2026 10:03:31 +0500 Subject: [PATCH] fix(integrations): Cline dispatches hyphenated /speckit- invocations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. — a name Cline never registered. Add a build_command_invocation override reusing format_cline_command_name, producing /speckit-, 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) --- src/specify_cli/integrations/cline/__init__.py | 13 +++++++++++++ tests/integrations/test_base.py | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/specify_cli/integrations/cline/__init__.py b/src/specify_cli/integrations/cline/__init__.py index a9b43e99ad..248f44d54d 100644 --- a/src/specify_cli/integrations/cline/__init__.py +++ b/src/specify_cli/integrations/cline/__init__.py @@ -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-``), so the + dispatch invocation must match. The inherited MarkdownIntegration default + builds the dotted ``/speckit.``, 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) diff --git a/tests/integrations/test_base.py b/tests/integrations/test_base.py index 92d51487a2..e78ef23613 100644 --- a/tests/integrations/test_base.py +++ b/tests/integrations/test_base.py @@ -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-), 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___ placeholder resolution."""