Skip to content

Commit c864fc7

Browse files
jawwad-aliclaude
andauthored
fix(integrations): Forge dispatches hyphenated /speckit-<cmd> invocations (#3529)
Forge installs its slash-commands with hyphenated names (speckit-foo-bar, via format_forge_command_name and the injected frontmatter name), but ForgeIntegration inherited MarkdownIntegration.build_command_invocation, which builds the dotted /speckit.<cmd>. So 'workflow'/command dispatch invoked /speckit.plan while the registered command is /speckit-plan — a name Forge never registered. Override build_command_invocation to reuse format_forge_command_name, producing /speckit-<name> (with '.'-to-'-' for extension commands), mirroring the skills agents' hyphenated invocation. Tests assert Forge 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 848e41b commit c864fc7

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/specify_cli/integrations/forge/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ class ForgeIntegration(MarkdownIntegration):
9191
}
9292
invoke_separator = "-"
9393

94+
def build_command_invocation(self, command_name: str, args: str = "") -> str:
95+
"""Forge installs hyphenated slash-commands (``/speckit-<name>``), so the
96+
dispatch invocation must match. The inherited MarkdownIntegration default
97+
builds the dotted ``/speckit.<name>``, which references a command Forge
98+
never registered. Reuse the same hyphenation as the installed frontmatter
99+
``name`` (see ``format_forge_command_name``), mirroring the skills agents.
100+
"""
101+
invocation = "/" + format_forge_command_name(command_name)
102+
if args:
103+
invocation = f"{invocation} {args}"
104+
return invocation
105+
94106
def setup(
95107
self,
96108
project_root: Path,

tests/integrations/test_base.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,24 @@ def test_skills_extension_command_with_args(self):
216216
i = get_integration("codex")
217217
assert i.build_command_invocation("speckit.git.commit", "fix typo") == "/speckit-git-commit fix typo"
218218

219+
def test_forge_core_command_hyphenated(self):
220+
"""Forge installs hyphenated slash-commands (/speckit-<name>), so the
221+
dispatch invocation must be hyphenated too — not the dotted default it
222+
would inherit from MarkdownIntegration."""
223+
from specify_cli.integrations import get_integration
224+
i = get_integration("forge")
225+
assert i.build_command_invocation("speckit.plan") == "/speckit-plan"
226+
assert i.build_command_invocation("plan") == "/speckit-plan"
227+
228+
def test_forge_extension_command_hyphenated(self):
229+
from specify_cli.integrations import get_integration
230+
i = get_integration("forge")
231+
assert i.build_command_invocation("speckit.git.commit") == "/speckit-git-commit"
232+
assert (
233+
i.build_command_invocation("speckit.git.commit", "fix typo")
234+
== "/speckit-git-commit fix typo"
235+
)
236+
219237

220238
class TestResolveCommandRefs:
221239
"""Tests for __SPECKIT_COMMAND_<NAME>__ placeholder resolution."""

0 commit comments

Comments
 (0)