Skip to content

💫 Toolkit to help you get started with SDD or any other process!

fix(integrations): Forge dispatches hyphenated /speckit-<cmd> invocations (#3529)

Ali jawwadc864fc74473d
diff --git a/src/specify_cli/integrations/forge/__init__.py b/src/specify_cli/integrations/forge/__init__.py
index 49407c3a7..f455556e3 100644
--- a/src/specify_cli/integrations/forge/__init__.py
+++ b/src/specify_cli/integrations/forge/__init__.py
@@ -91,6 +91,18 @@ class ForgeIntegration(MarkdownIntegration):
}
invoke_separator = "-"
+ def build_command_invocation(self, command_name: str, args: str = "") -> str:
+ """Forge 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 Forge
+ never registered. Reuse the same hyphenation as the installed frontmatter
+ ``name`` (see ``format_forge_command_name``), mirroring the skills agents.
+ """
+ invocation = "/" + format_forge_command_name(command_name)
+ if args:
+ invocation = f"{invocation} {args}"
+ return invocation
+
def setup(
self,
project_root: Path,
diff --git a/tests/integrations/test_base.py b/tests/integrations/test_base.py
index d03ea0cb2..6e6229ba3 100644
--- a/tests/integrations/test_base.py
+++ b/tests/integrations/test_base.py
@@ -216,6 +216,24 @@ class TestBuildCommandInvocation:
i = get_integration("codex")
assert i.build_command_invocation("speckit.git.commit", "fix typo") == "/speckit-git-commit fix typo"
+ def test_forge_core_command_hyphenated(self):
+ """Forge 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("forge")
+ assert i.build_command_invocation("speckit.plan") == "/speckit-plan"
+ assert i.build_command_invocation("plan") == "/speckit-plan"
+
+ def test_forge_extension_command_hyphenated(self):
+ from specify_cli.integrations import get_integration
+ i = get_integration("forge")
+ 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."""