Fix --dev extension agent symlinks#2554
Open
NgoQuocViet2001 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the specify extension add --dev regression (#2451) by enabling dev-mode installations to symlink generated agent artifacts to an extension-local .specify-dev cache when the OS supports symlinks, while preserving a copy-based fallback when symlinks can’t be created.
Changes:
- Thread a
link_outputs/link_commandsoption through extension install + command registration so dev installs can symlink agent command files to cached rendered outputs. - Extend the same dev-linking behavior to extension skill registration (SKILL.md generation) with a symlink fallback-to-copy strategy.
- Add tests covering symlink behavior and fallback behavior for Copilot agent command registration and
extension add --dev.
Show a summary per file
| File | Description |
|---|---|
| tests/test_extensions.py | Adds symlink capability detection plus dev-mode tests for symlinked Copilot agent command files and copy fallback. |
| src/specify_cli/extensions.py | Threads link_commands through extension install and skill registration; implements dev-cache + symlink logic for SKILL.md outputs. |
| src/specify_cli/agents.py | Adds link_outputs support in command registration, writing rendered outputs to .specify-dev and symlinking agent-facing files; updates unregister behavior for symlinks. |
| src/specify_cli/init.py | Enables link_commands=True for extension add --dev installs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
Comment on lines
+682
to
+684
| except OSError: | ||
| # Windows often requires Developer Mode or admin privileges for | ||
| # symlinks. Keep dev installs functional by falling back to a copy. |
| skill_file.unlink() | ||
| target = os.path.relpath(cache_file, skill_file.parent) | ||
| os.symlink(target, skill_file) | ||
| except OSError: |
mnriem
requested changes
May 14, 2026
Collaborator
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback. If not applicable, please explain why
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2451.
specify extension add --devnow asks extension registration to link generated agent command files when possible. The registrar writes rendered output into an extension-local.specify-devcache and points the agent-facing command file at it, while falling back to a normal copy when symlink creation is unavailable. The same option is threaded through extension skill registration, and unregister now removes symlinked command entries too.Follow-up review fixes also harden
.specify-devcache writes against path traversal and allow existing dev-mode SKILL.md symlinks to refresh their generated cache content on subsequent dev installs without overwriting user-managed non-symlink skills.Testing
PYTHONIOENCODING=utf-8 PYTHONUTF8=1 uv run specify --helpuv run specify --helpon this Windows cp1252 console hit an existing bannerUnicodeEncodeError; the UTF-8 run passed.uv sync --extra testuv run pytest tests/test_extensions.pyuv run pytest tests/test_extension_skills.pyuv run pytest tests/integrations/test_integration_subcommand.py -k "extension_add or switch_migrates_extension_commands or switch_migrates_copilot_skills_extension_commands"uvx ruff check src/specify_cli/agents.py src/specify_cli/extensions.py src/specify_cli/__init__.pygit diff --checkAI Disclosure
This PR was implemented with OpenAI Codex assistance. Codex helped identify the regression path, make the code changes, add tests, run validation, address review feedback, and draft this PR; I reviewed the resulting diff and test output before submission.