💫 Toolkit to help you get started with SDD or any other process!
fix(integrations): show hyphenated command names for docker-agent and junie (#4910)
Chaoqi9801d2b81055
diff --git a/src/specify_cli/_invocation_style.py b/src/specify_cli/_invocation_style.pyindex 3c867cc02..86926e23b 100644--- a/src/specify_cli/_invocation_style.py+++ b/src/specify_cli/_invocation_style.py@@ -13,7 +13,18 @@ DOLLAR_SKILLS_AGENTS: frozenset[str] = frozenset({"codex", "zcode", "command-cod# Agents that always render /speckit-<name>, regardless of ai_skills.ALWAYS_SLASH_AGENTS: frozenset[str] = frozenset(- {"devin", "droid", "dsh", "grok", "mcode", "muse", "qodercli", "trae", "zed"}+ {+ "devin",+ "docker-agent",+ "droid",+ "dsh",+ "grok",+ "mcode",+ "muse",+ "qodercli",+ "trae",+ "zed",+ })# Agents that render /speckit-<name> only when ai_skills is enabled.diff --git a/src/specify_cli/command_init.py b/src/specify_cli/command_init.pyindex cf6e9e1f3..ea21fb1a5 100644--- a/src/specify_cli/command_init.py+++ b/src/specify_cli/command_init.py@@ -1077,8 +1077,6 @@ def register(app: typer.Typer) -> None:muse_skill_mode = selected_ai == "muse" and _is_skills_integrationgrok_skill_mode = selected_ai == "grok" and _is_skills_integrationdsh_skill_mode = selected_ai == "dsh" and _is_skills_integration- cline_skill_mode = selected_ai == "cline"- forge_skill_mode = selected_ai == "forge"bob_skill_mode = selected_ai == "bob" and _is_skills_integrationnative_skill_mode = (codex_skill_mode@@ -1155,28 +1153,18 @@ def register(app: typer.Typer) -> None:step_num += 1usage_label = "skills" if native_skill_mode else "slash commands"- from ._invocation_style import (- is_dollar_skills_agent as _is_dollar_skills_agent,- is_slash_skills_agent as _is_slash_skills_agent,+ invoke_prefix = _invoke_prefix_for_integration(+ resolved_integration,+ resolved_integration.key,+ integration_parsed_options or None,+ project_path,+ )+ invoke_separator = resolved_integration.effective_invoke_separator(+ integration_parsed_options or None, project_root=project_path)-- # `_is_skills_integration` means the integration is installed in- # skills mode, which is the semantic equivalent of `ai_skills_enabled`- # used by `is_slash_skills_agent()`.- _ai_skills_enabled = _is_skills_integrationdef _display_cmd(name: str) -> str:- if _is_dollar_skills_agent(selected_ai, _ai_skills_enabled):- return f"$speckit-{name}"- if kimi_skill_mode:- return f"/skill:speckit-{name}"- if (- _is_slash_skills_agent(selected_ai, _ai_skills_enabled)- or cline_skill_mode- or forge_skill_mode- ):- return f"/speckit-{name}"- return f"/speckit.{name}"+ return f"{invoke_prefix}speckit{invoke_separator}{name}"steps_lines.append(f"{step_num}. Start using {usage_label} with your coding agent:"diff --git a/tests/integrations/test_integration_docker_agent.py b/tests/integrations/test_integration_docker_agent.pyindex fa2207927..173f75efd 100644--- a/tests/integrations/test_integration_docker_agent.py+++ b/tests/integrations/test_integration_docker_agent.py@@ -16,6 +16,30 @@ class TestDockerAgentIntegration(SkillsIntegrationTests):def test_multi_install_is_opt_in(self):assert DockerAgentIntegration().multi_install_safe is False+ def test_is_slash_skills_agent(self):+ """Docker Agent only installs `speckit-<name>/SKILL.md` skills, so the+ helper must agree with its own renderer with or without `ai_skills`+ (always slash, like Zed and Muse Code, which share that layout)."""+ from specify_cli._invocation_style import is_slash_skills_agent++ assert DockerAgentIntegration().build_command_invocation("plan") == "/speckit-plan"+ assert is_slash_skills_agent("docker-agent", True) is True+ assert is_slash_skills_agent("docker-agent", False) is True++ def test_hook_invocation_renders_the_hyphenated_form(self, tmp_path, monkeypatch):+ import specify_cli+ from specify_cli.extensions import HookExecutor++ monkeypatch.setattr(+ specify_cli,+ "load_init_options",+ lambda _root: {"ai": "docker-agent", "ai_skills": True},+ )++ rendered = HookExecutor(tmp_path)._render_hook_invocation("speckit.git.commit")++ assert rendered == "/speckit-git-commit"+def test_extra_args_are_applied_to_build_exec_args(monkeypatch):monkeypatch.setenv(diff --git a/tests/integrations/test_integration_junie.py b/tests/integrations/test_integration_junie.pyindex a6234ba73..e6fae0f69 100644--- a/tests/integrations/test_integration_junie.py+++ b/tests/integrations/test_integration_junie.py@@ -109,6 +109,30 @@ class TestJunieIntegration(MarkdownIntegrationTests):# Instruction stays on its own line rather than being mashed onto the note.assert "\n- For each executable hook, output the following:" in injected+ def test_init_next_steps_show_hyphenated_commands(self, tmp_path):+ """Next Steps must list the `/speckit-<name>` commands Junie installs."""+ from typer.testing import CliRunner++ from specify_cli import app++ result = CliRunner().invoke(+ app,+ [+ "init",+ str(tmp_path / "junie-next-steps"),+ "--integration",+ self.KEY,+ "--script",+ "sh",+ "--ignore-agent-tools",+ ],+ catch_exceptions=False,+ )++ assert result.exit_code == 0, result.output+ assert "/speckit-plan" in result.output+ assert "/speckit.plan" not in result.output+# -- Overrides for MarkdownIntegrationTests ---------------------------def test_setup_creates_files(self, tmp_path):