fix(extensions): normalize literal command calls in generated skills - #4521
MahinurRahman wants to merge 1 commit into
Conversation
Fixes github#3451 Assisted-by: Codex (autonomous)
|
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 Drafted for @mnriem by GitHub Copilot (model: GPT-6 Astra). |
There was a problem hiding this comment.
🟡 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, butPresetResolver._register_skillsrenders skills independently and calls onlyresolve_skill_placeholdersplus_resolve_skill_command_refsbefore writingSKILL.md(src/specify_cli/presets/__init__.py:3070-3106). A preset body containing/speckit.foo.bartherefore 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) |
| 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(".", "-") |
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 generatedSKILL.mdpreviously 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
$speckit-invocation-smoke-finishand the referenced skill existed.git diff --checkpassed.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.