fix(extensions): hyphenate in-body command refs when rendering skills#3476
fix(extensions): hyphenate in-body command refs when rendering skills#3476Quratulain-bilal wants to merge 1 commit into
Conversation
extension command bodies were copied verbatim into generated SKILL.md files for skills-based integrations (codex, claude, etc.), so an in-body reference like /speckit.foo.bar kept its slash-dot spelling. skills agents dispatch speckit-foo-bar skills, not /speckit.foo.bar slash commands, so the reference was not runnable and the agent fell back to a markdown-only path. the skill dir name and frontmatter hook refs were already hyphenated; the body was the missing piece. _register_extension_skills only ran resolve_skill_placeholders (script/args/paths) and post_process_skill_content (a hook-note only), never _hyphenate_body_refs. that helper already exists and is applied on the cline extension path; apply it here too. added a regression test that installs an extension whose command body references a sibling command and asserts the dotted ref is rewritten to the hyphenated skill name. confirmed it fails on the pre-fix code.
There was a problem hiding this comment.
Pull request overview
Rewrites dotted extension command references when generating skills.
Changes:
- Hyphenates in-body
speckit.*references. - Adds regression coverage for generated skill content.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions/__init__.py |
Rewrites command references during skill rendering. |
tests/test_extension_skills.py |
Adds a cross-command reference regression test. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Medium
| # slash commands, so a verbatim dotted reference is not runnable | ||
| # (see #3451). The skill dir name and frontmatter hook refs are | ||
| # already hyphenated elsewhere; the body was the missing piece. | ||
| body = registrar._hyphenate_body_refs(body) |
|
Please read comments to #3474 as we cannot take this PR as-is |
|
thanks @mnriem, read through your writeup on #3474 and you're right — the root cause isn't verbatim copy, it's that i confirmed the mechanism in code before agreeing: closing this in favor of your phased plan. i'd like to pick up phase 1 (documenting note: i used an ai assistant to help investigate and write this up. |
fixes #3451
extension command bodies were copied verbatim into generated SKILL.md files for skills-based integrations (codex, claude, etc.), so an in-body reference like
/speckit.foo.barkept its slash-dot spelling. skills agents dispatchspeckit-foo-barskills, not/speckit.foo.barslash commands, so the reference was not runnable and the agent fell back to a markdown-only path (as reported in discussion #3422 with codex + spec-kit-memory-hub).root cause (matches the issue):
_register_extension_skillsonly ranresolve_skill_placeholders(script/args/__AGENT__/project-relative paths) andpost_process_skill_content(which forSkillsIntegrationonly injects a hook-note), never a body-ref rewrite. the skill dir name and frontmatter hook refs were already hyphenated elsewhere; the body was the missing piece.fix: apply the existing
CommandRegistrar._hyphenate_body_refshelper in the skills render path, right afterresolve_skill_placeholders. that helper is already used on the cline extension path (agents.py); this reuses it. skills integrations always dispatch hyphenated skills, so the rewrite is unconditionally correct there.added a regression test: it installs an extension whose command body references a sibling command (
/speckit.test-ext.world) and asserts the generated skill body has the dotted ref rewritten tospeckit-test-ext-world. i confirmed it fails on the pre-fix code (the verbatimspeckit.test-ext.worldleaks into the body); the full extension-skills suite (58 tests) passes with the fix.this covers part 1 (code) of the issue's proposed fix. i left the docs-portability note (part 2) out of this PR to keep it focused; happy to follow up if you'd like it here.