fix: rewrite extension skill command references#3474
Conversation
Closes github#3451 Assisted-by: Codex (model: GPT-5, autonomous)
There was a problem hiding this comment.
Pull request overview
Rewrites portable extension command references into agent-native skill invocations while preserving links and paths.
Changes:
- Adds agent-specific reference rendering shared with hooks.
- Adds Codex, Kimi, and Claude coverage.
- Documents portable slash-dot references.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions/__init__.py |
Implements reference detection and rewriting. |
tests/test_extension_skills.py |
Tests invocation rendering and preservation. |
extensions/EXTENSION-USER-GUIDE.md |
Documents portable references. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Medium
| EXTENSION_COMMAND_NAME_PATTERN = re.compile(r"^speckit\.([a-z0-9-]+)\.([a-z0-9-]+)$") | ||
| _SPECKIT_SLASH_REF_PATTERN = re.compile( | ||
| r"(?<!\]\()(?<![.\w:/\\])" | ||
| r"/(speckit\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*)\b" |
| ) | ||
| EXTENSION_COMMAND_NAME_PATTERN = re.compile(r"^speckit\.([a-z0-9-]+)\.([a-z0-9-]+)$") | ||
| _SPECKIT_SLASH_REF_PATTERN = re.compile( | ||
| r"(?<!\]\()(?<![.\w:/\\])" |
| _MARKDOWN_LINK_DESTINATION_PREFIX_PATTERN = re.compile(r"\]\(\s*$") | ||
| _HTML_LINK_ATTRIBUTE_PREFIX_PATTERN = re.compile( | ||
| r"\b(?:href|src)\s*=\s*['\"]\s*$", re.IGNORECASE |
|
Thanks for the detailed writeup and the PR — the diagnosis of where skills rendering diverges is accurate and genuinely useful. I'd like to reframe the fix, though, because I think the root cause is different from "command markdown is copied verbatim." Spec Kit already ships a first-class, agent-neutral way to reference sibling commands from a command body: the
That said, this surfaced two legitimate defects on our side, plus a docs gap. I'd like to fix all three, phased: 1. Discoverability (docs only). 2. Enable the render path and define the default skill render. 3. Codex-specific render override. On top of that default, some agents override the invocation form: Codex renders Plan: three tracked issues, three PRs. #1 (docs) is fully independent. #2 wires token resolution into the skill path with the default You clearly did the hard part already — tracing the divergence and the render paths — and I'd love to see you address these if you have the bandwidth. If you're up for it, any of the three (starting with the docs fix, then #2, then #3) would be a great contribution, and I'm happy to review and help along the way. No pressure if the timing doesn't work — just let me know either way. The outcome is the same thing you're after — existing-style extensions render correctly for Codex — but achieved by making Spec Kit's own portability mechanism work end-to-end rather than by guessing intent from un-templated literals. |
Description
Closes #3451
Testing
uv run specify --helpuv sync && uv run pytestAdditional validation:
uv run pytest tests/test_extension_skills.py tests/test_extensions.py tests/integrations/test_base.py tests/integrations/test_integration_kimi.py tests/integrations/test_integration_zcode.py -q(527 passed, 14 skipped)uvx ruff check src/specify_cli/extensions/__init__.py tests/test_extension_skills.pygit diff --checkThe sample-project coverage installs an extension into temporary Codex, Kimi, and Claude projects and verifies both rewritten invocations and preserved path/link references.
AI Disclosure
Codex (GPT-5, autonomous) analyzed the issue, implemented and iteratively tested the change on behalf of @NgoQuocViet2001. The operator requested this contribution but did not manually author or line-by-line review the patch.