Skip to content

fix(extensions): normalize literal command calls in generated skills - #4521

Open
MahinurRahman wants to merge 1 commit into
github:mainfrom
MahinurRahman:fix/3451-extension-command-references
Open

MahinurRahman wants to merge 1 commit into
github:mainfrom
MahinurRahman:fix/3451-extension-command-references

Conversation

@MahinurRahman

Copy link
Copy Markdown

Summary

Fixes #3451.

Extension commands can contain literal cross-command calls such as /speckit.memory-md.prepare-context. When those commands are installed as skills, the generated SKILL.md previously retained the dotted slash form even for integrations that require hyphenated skill names or a different invocation prefix.

This change normalizes literal skill invocations in the shared skill renderer and extension-manager skill registration path. It supports Codex ($speckit-*), Claude/Copilot (/speckit-*), and Kimi (/skill:speckit-*). Canonical command IDs, file paths, URLs, and ordinary non-skill command layouts are preserved.

New regression coverage exercises four integrations through both skill registration paths, verifies idempotence and path/URL preservation, and confirms ordinary command output remains dotted.

Testing

  • Focused regression: 9 passed.
  • Broader extension/preset/placeholder run: 1,201 passed, 3 skipped, 23 deselected. Symlink-named tests were excluded because this Windows account cannot create symbolic links (WinError 1314); the failures were test setup failures, not assertion failures.
  • CLI smoke test: initialized a non-interactive Codex skills project with the PowerShell environment and installed a local two-command extension. The generated skill invoked $speckit-invocation-smoke-finish and the referenced skill existed.
  • git diff --check passed.

AI disclosure: Codex authored the implementation, tests, documentation, and validation on behalf of MahinurRahman. The work was performed autonomously; no human line-by-line review or external-agent execution is claimed.

@mnriem mnriem added the triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review label Sep 11, 2026
@mnriem
mnriem requested a balanced review from Copilot September 14, 2026 19:47
@mnriem

mnriem commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks @MahinurRahman — this addresses the reported cross-command invocation problem in both skills-rendering paths, and the portability guidance is a useful addition.

Please complete the AI disclosure with the model(s) used. Codex, autonomous mode, and the extent of assistance are already documented; only the model information is missing.

This remains triage-nice-to-have. The next maintainer steps are CI and review of the current head; there hasn’t been a review of this PR yet.

Drafted for @mnriem by GitHub Copilot (model: GPT-6 Astra).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved path, preset-rendering, and regression-test issues must be addressed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Normalizes dotted cross-command references in generated skills for Codex, Claude/Copilot, and Kimi integrations.

Changes:

  • Adds integration-specific skill invocation normalization.
  • Updates shared and extension skill-rendering logic.
  • Adds regression coverage and authoring guidance.
File summaries
File Summary
tests/test_extensions.py Adds cross-integration regression and preservation coverage.
src/specify_cli/extensions/__init__.py Applies normalization during extension skill registration. Critical (1 vote): an existing regression still expects dotted literals and must be reconciled with the new invocation behavior.
src/specify_cli/agents.py Implements shared normalization. Moderate (3 votes): absolute paths such as /speckit.plan.txt can be rewritten incorrectly. Moderate (1 vote): preset skill rendering bypasses this normalization.
extensions/EXTENSION-USER-GUIDE.md Documents portable cross-command references.
Review details

Suppressed comments (1)

src/specify_cli/agents.py:427

  • This only fixes callers that go through render_skill_command, but PresetResolver._register_skills renders skills independently and calls only resolve_skill_placeholders plus _resolve_skill_command_refs before writing SKILL.md (src/specify_cli/presets/__init__.py:3070-3106). A preset body containing /speckit.foo.bar therefore still emits the dotted form for skills integrations, despite this method claiming to cover every skill rendering path. Apply the same normalization in that path (or centralize body rendering) and add a preset regression.
            body = self.normalize_skill_invocations(agent_name, body)
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

selected_ai, frontmatter, body, self.project_root, extension_id=manifest.id
)
body = _resolve_command_ref_tokens(body)
body = registrar.normalize_skill_invocations(selected_ai, body)
Comment thread src/specify_cli/agents.py
Comment on lines +547 to +551
if command.endswith((".md", ".json", ".yml", ".yaml", ".toml")):
return command
if body[match.end():match.end() + 1] in ("/", "\\"):
return command
return prefix + command[1:].replace(".", "-")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Extension command references not rewritten for skills-based integrations (Codex), breaking cross-command invocation

3 participants