Skip to content

Commit 5533447

Browse files
committed
fix: apply hook-invocation note to generic --skills SKILL.md output
_build_skill_content() duplicated SkillsIntegration.setup()'s per-file body but dropped the call to post_process_skill_content(), which injects the dot-to-hyphen hook-invocation note before every "For each executable hook" instruction. Without it, a configured extension hook (e.g. speckit.git.commit) would be invoked verbatim as /speckit.git.commit, which doesn't exist under the speckit-<name>/SKILL.md layout this feature introduces. Add a small _GenericSkillsHelper(SkillsIntegration) — the same delegation pattern CopilotIntegration uses for its own skills mode — and call its post_process_skill_content() after building the SKILL.md body. Add a regression test asserting the note appears.
1 parent 588c904 commit 5533447

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎src/specify_cli/integrations/generic/__init__.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@
1414

1515
import yaml
1616

17-
from ..base import IntegrationOption, MarkdownIntegration, yaml_quote
17+
from ..base import IntegrationOption, MarkdownIntegration, SkillsIntegration, yaml_quote
1818
from ..manifest import IntegrationManifest
1919

2020

21+
class _GenericSkillsHelper(SkillsIntegration):
22+
"""Internal helper supplying skills-mode post-processing for
23+
``GenericIntegration`` (e.g. the dot-to-hyphen hook invocation note).
24+
25+
Not registered in the integration registry — ``GenericIntegration``
26+
itself renders skills content directly in ``_build_skill_content()``
27+
and only delegates to this helper's ``post_process_skill_content()``,
28+
mirroring the pattern ``CopilotIntegration`` uses for its skills mode.
29+
"""
30+
31+
key = "generic"
32+
33+
2134
class GenericIntegration(MarkdownIntegration):
2235
"""Integration for user-specified (generic) agents."""
2336

@@ -156,6 +169,7 @@ def _build_skill_content(
156169
f"---\n"
157170
f"{processed_body}"
158171
)
172+
skill_content = _GenericSkillsHelper().post_process_skill_content(skill_content)
159173
return skill_name, skill_content
160174

161175
def commands_dest(self, project_root: Path) -> Path:

‎tests/integrations/test_integration_generic.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,26 @@ def test_skill_content_has_expected_frontmatter(self, tmp_path):
253253
assert "__AGENT__" not in content
254254
assert "__SPECKIT_COMMAND_" not in content
255255

256+
def test_skill_content_has_hook_command_note(self, tmp_path):
257+
"""SKILL.md bodies get the shared dot-to-hyphen hook invocation
258+
note, matching what SkillsIntegration.setup() produces for other
259+
skills-format agents (e.g. Claude)."""
260+
i = get_integration("generic")
261+
m = IntegrationManifest("generic", tmp_path)
262+
i.setup(
263+
tmp_path, m,
264+
parsed_options={"commands_dir": ".myagent/skills", "skills": True},
265+
)
266+
constitution_skill = (
267+
tmp_path / ".myagent" / "skills" / "speckit-constitution" / "SKILL.md"
268+
)
269+
assert constitution_skill.exists()
270+
content = constitution_skill.read_text(encoding="utf-8")
271+
assert (
272+
"replace dots (`.`) with hyphens (`-`)" in content
273+
), "generic --skills output is missing the hook-invocation note"
274+
assert "`speckit.git.commit` → `/speckit-git-commit`" in content
275+
256276
def test_skills_flag_false_keeps_flat_markdown(self, tmp_path):
257277
"""Without --skills, behavior is unchanged: flat speckit.<name>.md files."""
258278
i = get_integration("generic")

0 commit comments

Comments
 (0)