Skip to content

Commit 4e78490

Browse files
jawwad-aliclaude
andcommitted
fix(init): show hyphenated /speckit-<name> in Next Steps for Forge projects
The post-init "Next Steps" panel renders recommended slash commands via the nested `_display_cmd()`. It special-cased dollar-skills agents, kimi, slash-skills agents, and cline, but not Forge. For a Forge project `_display_cmd` fell through to `return f"/speckit.{name}"`, printing `/speckit.constitution`, `/speckit.specify`, etc. Forge only registers the hyphenated form (`/speckit-<name>`, per `format_forge_command_name` / `ForgeIntegration.build_command_invocation`, and the generated command-file tests already assert this), so the panel told Forge users to run commands that don't exist under the dotted name. Add `forge_skill_mode` alongside `cline_skill_mode` and include it in the hyphenated-slash condition, mirroring how cline (also a non-skills markdown agent with hyphenated commands) is handled. Other agents unaffected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d7699c3 commit 4e78490

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

src/specify_cli/commands/init.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ def init(
700700
zed_skill_mode = selected_ai == "zed" and _is_skills_integration
701701
grok_skill_mode = selected_ai == "grok" and _is_skills_integration
702702
cline_skill_mode = selected_ai == "cline"
703+
forge_skill_mode = selected_ai == "forge"
703704
bob_skill_mode = selected_ai == "bob" and _is_skills_integration
704705
native_skill_mode = (
705706
codex_skill_mode
@@ -776,6 +777,7 @@ def _display_cmd(name: str) -> str:
776777
if (
777778
_is_slash_skills_agent(selected_ai, _ai_skills_enabled)
778779
or cline_skill_mode
780+
or forge_skill_mode
779781
):
780782
return f"/speckit-{name}"
781783
return f"/speckit.{name}"

tests/integrations/test_integration_forge.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,39 @@ def test_git_extension_command_uses_hyphen_notation(self, tmp_path):
475475
"Found '/speckit.specify' (dot notation) in generated Forge git.feature command body. "
476476
"Forge requires hyphen notation for ZSH compatibility."
477477
)
478+
479+
480+
class TestForgeInitNextSteps:
481+
"""The post-init 'Next steps' panel must show hyphenated /speckit-<name>
482+
commands for Forge, since Forge only registers the hyphenated form
483+
(see the generated command-file tests above)."""
484+
485+
def test_init_next_steps_show_hyphenated_commands(self, tmp_path):
486+
import os
487+
488+
from typer.testing import CliRunner
489+
490+
from specify_cli import app
491+
492+
project = tmp_path / "forge-nextsteps"
493+
project.mkdir()
494+
old_cwd = os.getcwd()
495+
try:
496+
os.chdir(project)
497+
result = CliRunner().invoke(
498+
app,
499+
["init", "--here", "--integration", "forge", "--ignore-agent-tools"],
500+
catch_exceptions=False,
501+
)
502+
finally:
503+
os.chdir(old_cwd)
504+
505+
assert result.exit_code == 0, f"init failed: {result.output}"
506+
# Forge registers /speckit-<name>; the next-steps panel must match.
507+
assert "/speckit-plan" in result.output, (
508+
f"Expected /speckit-plan in next steps but got:\n{result.output}"
509+
)
510+
# Must NOT show the dotted /speckit.plan form Forge can't invoke.
511+
assert "/speckit.plan" not in result.output, (
512+
f"Should not show dotted /speckit.plan for Forge:\n{result.output}"
513+
)

0 commit comments

Comments
 (0)