Skip to content

Commit 60bd86d

Browse files
BenBtgCopilot
andcommitted
fix(integrations): add Kimi /skill: prefix and fix docstrings
- Add SKILL_COLON_AGENTS frozenset and get_invocation_prefix() to _invocation_style.py so Kimi resolves to '/skill:' in skills mode - Switch invoke_prefix_for_integration() to use get_invocation_prefix() instead of the binary dollar/slash check - Update post_process_skill_content docstring (base.py) to cover both slash and dollar native invocation forms - Update _resolve_command_refs_in_skill docstring (presets/__init__.py) to document the dollar-prefixed result alongside slash forms Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 65ef91d9-4c31-4f31-a009-ed2093fe7f28 Assisted-by: GitHub Copilot (model: claude-sonnet-4.6, autonomous)
1 parent 0532576 commit 60bd86d

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

src/specify_cli/_invocation_style.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
}
3030
)
3131

32+
# Agents that render /skill:<name> (skill-colon invocation) when in skills mode.
33+
SKILL_COLON_AGENTS: frozenset[str] = frozenset({"kimi"})
34+
3235

3336
def is_dollar_skills_agent(selected_ai: str | None, ai_skills_enabled: bool) -> bool:
3437
"""Return ``True`` if *selected_ai* uses ``$speckit-<name>`` invocations.
@@ -41,6 +44,21 @@ def is_dollar_skills_agent(selected_ai: str | None, ai_skills_enabled: bool) ->
4144
return selected_ai in DOLLAR_SKILLS_AGENTS and ai_skills_enabled
4245

4346

47+
def get_invocation_prefix(selected_ai: str | None, ai_skills_enabled: bool) -> str:
48+
"""Return the native invocation prefix for *selected_ai* in skills mode.
49+
50+
Returns ``"$"`` for dollar-skills agents (Codex, ZCode),
51+
``"/skill:"`` for skill-colon agents (Kimi), and ``"/"`` for all others.
52+
"""
53+
if not isinstance(selected_ai, str):
54+
return "/"
55+
if selected_ai in DOLLAR_SKILLS_AGENTS and ai_skills_enabled:
56+
return "$"
57+
if selected_ai in SKILL_COLON_AGENTS and ai_skills_enabled:
58+
return "/skill:"
59+
return "/"
60+
61+
4462
def is_slash_skills_agent(selected_ai: str | None, ai_skills_enabled: bool) -> bool:
4563
"""Return ``True`` if *selected_ai* uses ``/speckit-<name>`` invocations.
4664

src/specify_cli/integration_runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections.abc import Callable
66
from typing import Any
77

8-
from ._invocation_style import is_dollar_skills_agent
8+
from ._invocation_style import get_invocation_prefix
99
from .integration_state import integration_setting, integration_settings
1010

1111

@@ -103,4 +103,4 @@ def invoke_prefix_for_integration(
103103
) -> str:
104104
"""Resolve the native invocation prefix for an integration's output mode."""
105105
skills_mode = integration.is_skills_mode(parsed_options, project_root)
106-
return "$" if is_dollar_skills_agent(key, skills_mode) else "/"
106+
return get_invocation_prefix(key, skills_mode)

src/specify_cli/integrations/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,8 +1597,10 @@ def post_process_skill_content(self, content: str) -> str:
15971597
Called by external skill generators (presets, extensions) to let
15981598
the integration inject agent-specific frontmatter or body
15991599
transformations. The base implementation injects shared skills
1600-
guidance for converting dotted hook command names to hyphenated
1601-
slash commands. Subclasses may override — see ``ClaudeIntegration``.
1600+
guidance for converting dotted hook command names to the agent-native
1601+
hyphenated command invocation (e.g. ``/speckit-git-commit`` or
1602+
``$speckit-git-commit``). Subclasses may override -- see
1603+
``ClaudeIntegration``.
16021604
"""
16031605
invocation_prefix = "$" if is_dollar_skills_agent(self.key, True) else "/"
16041606
return self._inject_hook_command_note(content, invocation_prefix)

src/specify_cli/presets/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,9 @@ def _resolve_skill_command_refs(
12621262
12631263
Looks up the agent's invoke separator and rewrites each
12641264
``__SPECKIT_COMMAND_<NAME>__`` placeholder into the matching
1265-
slash-command invocation ``/speckit-<cmd>`` for a ``-`` separator,
1266-
``/speckit.<cmd>`` for ``.`` the same rendering the command layer
1267-
applies via ``CommandRegistrar.register_commands()``.
1265+
agent-native invocation -- ``/speckit-<cmd>`` or ``$speckit-<cmd>`` for
1266+
a ``-`` separator, ``/speckit.<cmd>`` for ``.`` -- the same rendering the
1267+
command layer applies via ``CommandRegistrar.register_commands()``.
12681268
12691269
For dual-layout agents (e.g. Bob) the separator depends on the
12701270
project's persisted skills state, so — when *project_root* is provided

0 commit comments

Comments
 (0)