Skip to content
Open
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
12 changes: 12 additions & 0 deletions src/specify_cli/integrations/forge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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 @@ -216,6 +216,24 @@ def test_skills_extension_command_with_args(self):
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."""
Expand Down